Checking Collision Between Two Entities

← All Topics
You are here:

Checking Collision Between Two Entities

You can check for collision between 2 entities (3D models) on the screen by submitting a collision event handler for example:

m1 is a Sinbad having pos=(4,0,0)
m2 is a Dragon having pos=(-4,0,0)
m1.move right 8 in 10 seconds async
m2.move left 8 in 10 seconds async

when m1 collides with m2 do
  sys.print "collision between Sinbad and Dragon"
  wait 0.5 seconds 
  sys.print "" 
end do

As you can see the collision event handler code is pretty straight forward. You just need to specify which entities you wanna check collision for and put all the relevant collision code inside the do-end do block

Previous Attaching 2D/3D Entity To Another 3D Model
Next Inspecting Which Animations Are Supported By A Given 3D Model