Ah yes of course.....Orulex uses a function as a mesh would add too many triangles and would not appear as smooth as Orulex does now. And the elevation can be got very accurately too.
So I think the elevation should be enough for my needs. I was looking at adapting the code from DeltaGlider-oruSDK.cpp :
Code:
//Global planet-relative position
VECTOR3 vv,pv;
oapiGetGlobalPos(GetSurfaceRef(),&pv);
GetGlobalPos(vv);
vv-=pv;
//Elevation measured from the center
double e=ORUGetElevByVec(v32v4(vv))-oapiGetSize(GetSurfaceRef());
double a=GetAltitude()-e;
So basically you are just getting a vector to the planet's position and subtracting it from the vessel's vector. But since this distance would include the planet's radius, so you remove that as well using oapiGetSize()
Now, ORUGetElevByVec() requires a 4 dimensional vector of the form v4.x=v.x;
v4.y=v.y;
v4.z=v.z;
v4.m=0;
What does m stand for and why is it set to 0 ? Also :
v32v4(vv))-oapiGetSize(GetSurfaceRef()
Isnt this subtracting a vector from a scalar() or rather a union from a double here ? Since Vector 4 is defined as a union:
typedef union{
double data[4];
struct {double x,y,z,m;};
}VECTOR4;
I was unable to get exactly what will be subtracted from what here.
Also I was thinking of getting the exact elevation of the terrain for the points around a vessel's periphery by simply off-setting the vector vv by the distance of the point at the periphery of the vessel(in vessel local co-ordinates)
eg if a vessel is say 2 metres a long and the vessel is poised at the edge of a cliff(or crater) such that half of it is sticking out beyond the edge and half of it is still safe with some terrain below it. So if I offset the vv by 1 metre so that it now points to the nose and supplied it to ORUGetElevByVec(), then I should get a much higher elevation for the nose right ? This is because the nose is further above the terrain as the terrain has dropped sharply towards the normal orbiter planetary surface, at the edge of the crater.
By the way I was wondering how you are able to draw directly into the Orbiter environment. Is it possible to get a DirectX handle of some sort to render 3D stuff directly into the screen ?
------------------
Meaning: you are better off setting the position manually at each time step?
Is it possible to set a vessel's position to any random position instantaneously ? If it is, then it may be easier to implement decks where vessel's can land on. I had tried to use AddForce as follows to cancel out all forces acting on a vessel when its landed :
GetForceVector(dir);
if(apply == TRUE)
AddForce(_V(-dir.x, -dir.y, -dir.z), _V(0,0,0));
Well..I tried it with a simple cube vessel landed at Brighton and it began to bounce violently. If it was that easy then we would have had more addons with vessels landing at elevated decks

!
Though I wonder why this is unable to cancel out the resultant force completely on a vessel.
---------------------
Artlav,
ok I got the last Collision SDK :
http://orbides.1gb.ru/collision_ml_090616.zip in the thread you mentioned.
So this will work with Meshland 2 meshes right ? And I guess with Meshland 2, I can make a custom terrain just like the NASSP guys did ? I want to make one with deep valleys and cliffs that would be fun to explore.
http://orbides.1gb.ru/collision_ml_090616.zip
There was some issue with jumping mentioned towards the end of the thread. Were you able to resolve it ? It wont really make any difference to me since I wont exactly land on the mesh - just fly over it maintaining a constant altitude. I will try with both Meshland 2 and Orulex and see which one works out better.