Hi,
Not sure why my terrain is not returning a hit when I am clearly directly above it. I have tried many different tweaks, and nothing returns a hit. Really at a loss here. Would appreciate any help.
startX# = GetobjectX(game.player.objID)+GetCameraX(1) //GetObjectX( game.player.objID )
startY# = GetobjectY(game.player.objID)+GetCameraY(1) //GetObjectY( game.player.objID )
startZ# = GetobjectZ(game.player.objID)+GetCameraZ(1) //GetObjectZ( game.player.objID )
endX# = 800*GetobjectX(game.player.objID)+GetCameraX(1)
endY# = 800*GetobjectY(game.player.objID)+GetCameraY(1)
endZ# = 800*GetobjectZ(game.player.objID)+GetCameraZ(1)
SetObjectCollisionMode( 1, 1 )
object_hit = ObjectRayCast( 1, startX#, startY#, startZ#, endX#, endY#, endZ# )
x# = GetObjectraycastX( 0 )
y# = GetObjectraycastY( 0 )
z# = GetObjectraycastZ( 0 )
SetObjectCollisionMode( 1, 0 )
SetObjectPosition( game.player.objID, x#, y#, z# )
edit: Forgot to mention - I have tried using objects straight from blender, creating a plane and creating objects from heightmaps.
If I make the endY# negative, I get a hit, but the coordinates do no line up with where my character is. Plus the Y coordinate is incorrect. I could be under the terrain, and according to the y# return its under my character...