Done more testing. only happens if object has more then one mesh , test code:
SetVirtualResolution(1024,768)
SetScissor(0,0,0,0)
SetClearColor( 0,0,0 )
LoadObjectWithChildren(1,"palm03.x") // must have more then one mesh.
SetObjectScalePermanent(1,0.01,0.01,0.01)
InstanceObject(2,1)
SetObjectPosition(2,45,0,0)
SetObjectCollisionMode(1,1)
SetObjectCollisionMode(2,1)
do
// control the camera
if ( GetRawKeyState( 87 ) ) then MoveCameraLocalZ( 1, 0.2 )
if ( GetRawKeyState( 83 ) ) then MoveCameraLocalZ( 1, -0.2 )
if ( GetRawKeyState( 65 ) ) then MoveCameraLocalX( 1, -0.2 )
if ( GetRawKeyState( 68 ) ) then MoveCameraLocalX( 1, 0.2 )
if ( GetRawKeyState( 81 ) ) then MoveCameraLocalY( 1, -0.2 )
if ( GetRawKeyState( 69 ) ) then MoveCameraLocalY( 1, 0.2 )
if ( GetPointerPressed() )
startx# = GetPointerX()
starty# = GetPointerY()
angx# = GetCameraAngleX(1)
angy# = GetCameraAngleY(1)
pressed = 1
endif
if ( GetPointerState() = 1 )
fDiffX# = (GetPointerX() - startx#)/4.0
fDiffY# = (GetPointerY() - starty#)/4.0
newX# = angx# + fDiffY#
if ( newX# > 89 ) then newX# = 89
if ( newX# < -89 ) then newX# = -89
SetCameraRotation( 1, newX#, angy# + fDiffX#, 0 )
endif
DrawBox( 510,382,514,385, 0, 0, 0, 0, 1 )
DrawBox( 511,383,513,384, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 1 )
oldx# = GetCameraX(1)
oldy# = GetCameraY(1)
oldz# = GetCameraZ(1)
MoveCameraLocalZ(1, 1000)
newx# = GetCameraX(1)
newy# = GetCameraY(1)
newz# = GetCameraZ(1)
MoveCameraLocalZ(1, -1000)
hit = ObjectRayCast( 0, oldx#, oldy#, oldz#, newx#, newy#, newz# )
Print(hit)
Print(ScreenFPS())
sync()
loop
best regards Preben Eriksen,