It has something to do with disabling collision and using SetObjectScalePermanent:
SetVirtualResolution(1024,768)
SetScissor(0,0,0,0)
SetClearColor( 0,0,0 )
CreateObjectBox( 1, 10, 10, 10 )
SetObjectCollisionMode(1,0)
SetObjectScalePermanent(1,1.0,1.0,1.0)
InstanceObject(2,1)
SetObjectPosition(2,15,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, 100)
newx# = GetCameraX(1)
newy# = GetCameraY(1)
newz# = GetCameraZ(1)
MoveCameraLocalZ(1, -100)
hit = ObjectRayCast( 0, oldx#, oldy#, oldz#, newx#, newy#, newz# )
Print(hit)
Print(ScreenFPS())
sync()
loop
If you remove SetObjectScalePermanent in the sample above , then collision is working on object 2 ?
best regards Preben Eriksen,