Movement Up / Down

Blitz3D Forums/Blitz3D Beginners Area/Movement Up / Down

Merrie(Posted 2007) [#1]
How would I make the code for the camera to go up & down on the Y line? Here is what I have and it is not working. Im using the Page Up/Page Down buttons. It is the last two lines of the function for moveentity.
Thanks!

Function object_key_control( obj )
If KeyDown( 200 )=True Then MoveEntity obj,0,0,1
If KeyDown( 208 )=True Then MoveEntity obj,0,0,-1
If KeyDown( 203 )=True Then TurnEntity obj,0,2,0
If KeyDown( 205 )=True Then TurnEntity obj,0,-2,0
If KeyDown( 201 )=True Then MoveEntity obj,0,1,0
If KeyDown( 209 )=True Then MoveEntity obj,0,-1,0
ex#=EntityX(obj):ez#=EntityZ(obj)
PositionEntity obj,ex,TerrainY( land,ex,0,ez )+5,ez
End Function



jfk EO-11110(Posted 2007) [#2]
the reason why is you use positionentity there, with a fixed height over the terrain. You should make the height variable, something like

if keydown(201) then height#=height+1
...
positionentity obj,ex,terrainy(ex,0,ez) + height + 5,ez
...


Merrie(Posted 2007) [#3]
Thank you I will give this a try and see what I can do.


(tu) sinu(Posted 2007) [#4]
or translateentity instead of positionentity