Hi all, im still struggling to find out how agk basic collision work. Poor me for my understanding.haha. Can someone help to see my code to check the balling falling with print "collided". Should be simple but *sigh* but dont know why i still dont get it. Help check please
// set window properties
SetWindowTitle( "testsimplecollision" )
SetWindowSize( 800,480, 0 )
// set display properties
SetVirtualResolution( 800,480 )
SetOrientationAllowed( 1, 1, 1, 1 )
setclearcolor (0,0,0)
court=CreateObjectBox(10,1,10)
SetObjectCollisionMode(court,1)
ball=CreateObjectSphere(0.5,6,6)
SetObjectPosition(ball,0,15,0)
SetObjectCollisionMode(ball,1)
oldx#=getobjectx(ball)
oldy#=getobjecty(ball)
oldz#=getobjectz(ball)
SetCameraPosition(1,0,5,12)
SetCameraLookAt(1,0,0,0,0)
ballspeedY#=-0.1
do
newx#=getobjectx(ball)
newy#=getobjecty(ball)
newz#=getobjectz(ball)
if ObjectRayCast(ball,oldx#,oldy#,oldz#,newx#,newy#,newz#)=1
Print("collide")
endif
MoveObjectLocalY(ball,ballspeedY#)
Print(ballspeedY#)
Print(oldy#)
Print(newy#)
Print( ScreenFPS() )
Sync()
loop