I am trying to make a vehicle traverse the contours of a matrix in conjuction with the GET GROUND HEIGHT command. This is what I have so far:
position object 2,playerx#,playery#,playerz#
set object to object orientation 2,1 : move object 2,10
playerfronty# = get ground height(1,object position x(2),object position z(2))+hoverheight
position object 2,playerx#,playery#,playerz#
set object to object orientation 2,1 : move object 2,-10
playerbacky# = get ground height(1,object position x(2),object position z(2))+hoverheight
position object 2,playerx#,playery#,playerz#
set object to object orientation 2,1 : move object left 2,5
playerlefty# = get ground height(1,object position x(2),object position z(2))+hoverheight
position object 2,playerx#,playery#,playerz#
set object to object orientation 2,1 : move object right 2,5
playerrighty# = get ground height(1,object position x(2),object position z(2))+hoverheight
set object rotation zyx 1
if playerangle# > 0 and playerangle# < 180 then zrotate object 1,atanfull(playerlefty#-playerrighty#,5)
if playerangle# > 180 or playerangle# < 360 then zrotate object 1,atanfull(playerrighty#-playerlefty#,5)
if playerangle# > 270 or playerangle# < 90 then xrotate object 1,atanfull(playerbacky#-playerfronty#,10)
if playerangle# > 90 and playerangle# < 270 then xrotate object 1,atanfull(playerfronty#-playerbacky#,10)
where object 1 is my vehicle and object 2 is a invisible object. This method sort of works but sometimes the angles are wrong. Does anyone know how to accomplish this easily?
Thanks!