If I have a mesh Terrain (Not Blitz's Native Terrain), Centered at 0,0 And a Ship above it. Can I tell The Height of the Mesh (The y Component) to compare it with the ship to determine Altitude?
If so, Can someone give me an Idea.
Thanks,
Eric
you can do this in quite a few ways.
You could take a pivot way above the terrain, with collisions set up to test the pivot colliding with the terrain, then move it down until it hits the terrain. At that point, get it's Y value.
You could use camera picking, and point the camera down the Y axis at the X/Z location you want to check the height of, and then get the pickedy() value from it.
You could easily use linepicking. AKA:
LinePick(X, 500, Z, X, -500, Z), and again get the Y with PickedY().
I would personally use the third method, but there are a few options for ya.
I tried the LinePick Method, Before I Wrote this Question.. And Couldn't get it to work, So now that you suggested it, It now works>> Go figure.....
Thanks for the Advice.
Regards,
Eric
Or simply calculate it based on the data you uset to build the terrain.
That would be the faster method, which I managed to leave out. Sleepy time :).
Ebusiness,
Please Explain a Little More.
My Terrain is a .X Format File From TrueSpace
Regards,
Eric
Your code might look something like what follows:
; Make mesh pickable
EntityPickMode mesh%(j,k),2
; Calculate height of ship entity above terrain mesh
h1#=GetmeshHgt(Ship,1024,-4096)+MeshHeight(ship)/2+100
Function GetMeshHgt(ent, PosOffset, NegOffset)
Pick=LinePick(EntityX(ent),EntityY(ent)+PosOffset,EntityZ(ent),0,NegOffset,0)
Return PickedY#()
End Function