if you want vehicle to align on terrain and "slide" about on it (no physics) you can do something like this (code adapted from original Blitz3D code by MadJack)

veh.mesh is just the vehicle body. Wheels are attached to veh.pivot.

As AGK has no pivots I use small invisible cubes instead.

4 cubes are attached to veh.pivot in a cross formation matching dimensions of vehicle.

one at front,one at rear, one on left and one on right

veh.FrontHeight, veh.RearHeight etc.

I split out the veh.mesh from the veh.pivot so the vehicle body angle can be independant of the wheels which are always stuck to the ground. It should be possible to take this further so that the body will bounce around or the vehicle can jump off the terrain.

` //get current position of vehicle`

x#=getobjectWorldX(veh.pivot)

y#=getobjectWorldY(veh.pivot)

z#=getObjectWorldZ(veh.pivot)

airborne as Integer

veh.speed = veh.speed *0.99

if abs(veh.speed) < 0.001 then veh.speed = 0.0

yaw#=getobjectWorldAngleY(veh.pivot)

//get heights of the 4 pivots on the terrain

veh.FrontHeight = GetObjectHeightMapHeight(veh.terrain,GetObjectWorldX(veh.FrontPivot),GetObjectWorldZ(veh.FrontPivot))

veh.RearHeight = GetObjectHeightMapHeight(veh.terrain,GetObjectWorldX(veh.RearPivot),GetObjectWorldZ(veh.RearPivot))

veh.LeftHeight = GetObjectHeightMapHeight(veh.terrain,GetObjectWorldX(veh.LeftPivot),GetObjectWorldZ(veh.LeftPivot))

veh.RightHeight = GetObjectHeightMapHeight(veh.terrain,GetObjectWorldX(veh.RightPivot),GetObjectWorldZ(veh.RightPivot))

//calculate angles based on these heights

pitchx# = veh.carlength

pitchy# = (veh.frontheight - veh.rearheight)

pitch# = ATan2(pitchx#,pitchy#)

rollx# = veh.carwidth

rolly# = (veh.leftheight - veh.rightheight)

roll# = ATan2(rollx#,rolly#)

pitch# = pitch#-90.0

SetObjectRotation(veh.pivot, pitch#,yaw#,roll#)

veh.th=0.35+veh.carheight/2+((veh.frontheight+veh.rearheight+veh.leftheight+veh.rightheight)/4.0)

SetObjectPosition(veh.pivot,getObjectX(veh.pivot),veh.th,GetObjectZ(veh.pivot))

MoveObjectLocalZ(veh.pivot,veh.speed)

for i = 1 to 4//numwheels

rotateobjectlocalX(veh.wheels[i].mesh,veh.speed*50)

next

//do some stuff to flatten out the angle changes so vehicle mesh angle lags behind wheels a bit

pitch# = fmod(pitch#,360)

roll# = fmod(roll#,360)

yaw# = fmod(yaw#,360)

veh.oldrotationx = fmod(veh.oldRotationX,360)

veh.oldrotationy = fmod(veh.oldRotationY,360)

veh.oldrotationz = fmod(veh.oldRotationZ,360)

veh.oldRotationX = veh.oldRotationX + (pitch#-veh.oldRotationX)*0.1

veh.oldRotationY = yaw#

veh.oldRotationZ = veh.oldRotationZ + (roll#-veh.oldRotationZ)*0.1

SetObjectPosition(veh.mesh,getObjectX(veh.pivot),veh.th,GetObjectZ(veh.pivot))

setobjectrotation(veh.mesh,veh.oldRotationX,veh.oldRotationY,veh.oldRotationZ)