Hi Blendman,
Here is the function i use to move objects around.
function movemoveobjects(bTween#)
// place player col mesh
SetObjectVisible(playercolmesh,1)
SetObjectPosition(playercolmesh , GetCameraX(1) , 6, GetCameraZ(1))
SetObjectRotation(playercolmesh,GetCameraAngleX(1),GetCameraAngleY(1),GetCameraAngleZ(1) )
SetObjectCollisionMode(playercolmesh,1)
// move player collision mesh forward ( outside the normal player camera collision check ).
// so the first thing checked is if we are moving a object.
MoveObjectLocalZ(playercolmesh,8)
SetObjectRotation(playercolmesh,GetCameraAngleX(1),GetCameraAngleY(1)+(45),GetCameraAngleZ(1) )
for a = 1 to maxmoveobjects
//moveobjects
mobjx# = GetObjectX(moveobjects[a])
mobjy# = GetObjectY(moveobjects[a])
mobjz# = GetObjectZ(moveobjects[a])
mobjax# = GetObjectAngleX(moveobjects[a])
mobjay# = GetObjectAngleY(moveobjects[a])
mobjaz# = GetObjectAngleZ(moveobjects[a])
SetObjectLookAt( moveobjects[a], GetCameraX(1), 20, GetCameraZ(1), 0 )
// move to fake xyz a little behind hit point.
MoveObjectLocalZ(moveobjects[a],-(0.2*bTween#))
SetObjectCollisionMode(moveobjects[a],1)
object_hit = ObjectSphereSlide( 0 , GetObjectX(moveobjects[a]) , 13 , GetObjectZ(moveobjects[a]) , mobjx# , 13, mobjz# ,6 )
if object_hit = playercolmesh //= playercolmesh
monewx#=GetObjectRayCastSlideX(0)
monewz#=GetObjectRayCastSlideZ(0)
SetObjectPosition(moveobjects[a],monewx#,0,monewz#)
SetObjectRotation(moveobjects[a],mobjax#,mobjay#,mobjaz#)
// check again, real old pos + new pos.
SetObjectCollisionMode(playercolmesh,0) // not player this time.
SetObjectCollisionMode(moveobjects[a],0) // not ourself
// check if we collide with other objects or the level.
object_hit = ObjectSphereSlide( 0 , mobjx# , 5, mobjz#, GetObjectX(moveobjects[a]) , 5 , GetObjectZ(moveobjects[a]) ,4 )
if object_hit > 0 and object_hit <> playercolmesh
// after we moved the object here , it collide with the level or another object.
// so move back to the original zyx that is free of collision.
SetObjectPosition(moveobjects[a],mobjx#,mobjy#,mobjz#)
SetObjectRotation(moveobjects[a],mobjax#,mobjay#,mobjaz#)
endif
else
// no collision with player , stay still.
SetObjectPosition(moveobjects[a],mobjx#,mobjy#,mobjz#)
SetObjectRotation(moveobjects[a],mobjax#,mobjay#,mobjaz#)
endif
SetObjectCollisionMode(moveobjects[a],1)
next a
SetObjectCollisionMode(playercolmesh,0)
SetObjectVisible(playercolmesh,0)
endfunction
Hope your able to use it
best regards Preben Eriksen,