meshY help FPS

Blitz3D Forums/Blitz3D Programming/meshY help FPS

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Sure. Happy to help. I also made a slight mistake in the LinePick() line but here's the updated version :

;'mesh' is your mesh landscape
mesh=loadmesh("mesh.b3d") 
;turn on polygon picking for the landscape
entitypickmode(mesh,2) 

repeat 
;...your code

;once you've updated your characters position, put this code in
;mycamera is your camera entity
;player_x is the x coordinate of the player. Use entityx() to get this
;player_z is the z coordinate of the player. Use entityz() to get this
;player_tall is the height you want to keep the camera above the ground

positionentity(mycamera,player_x#,meshy(player_x#,player_z#,30)+player_tall#,player_z#) 
;your code 
forever 

function meshy#(x#,z#,maxheight#,radius#=0.1) 
;this function returns the height (y) of a mesh landscape at the x,z coords given 
;maxheight is the height of the highest point of your landscape (just guess or use a large number)
linepick(x,maxheight,z,0,0-(maxheight*2),0,radius#) 
return pickedy() 
end function