3D Lingo Dictionary > C-D > collisionData |
![]() ![]() ![]() |
collisionData
Syntax
on myHandlerName
me, collisionData
Description
3D data object; sent as an argument with the #collideWith
and #collideAny
events to the handler specified in the registerForEvent
, registerScript
, and setCollisionCallback
commands. The collisionData
object has these properties:
modelA
is one of the models involved in the collision.
modelB
is the other model involved in the collision.
pointOfContact
is the world position of the collision.
collisionNormal
is the direction of the collision.
Example
This example has three parts. The first part is the first line of code, which registers the #putDetails
handler for the #collideAny
event. The second part is the #putDetails
handler. When two models in the cast member MyScene collide, the #putDetails
handler is called and the collisionData
argument is sent to it. This handler displays the four properties of the collisionData
object in the message window. The third part of the example shows the results from the message window. The first two lines show that the model named GreenBall was model A and the model named YellowBall was model B in the collision. The third line shows the point of contact of the two models. The last line shows the direction of the collision.
member("MyScene").registerForEvent(#collideAny, #putDetails, 0) on putDetails me, collisionData put collisionData.modelA put collisionData.modelB put collisionData.pointOfContact put collisionData.collisionNormal end -- model("GreenBall") -- model("YellowBall") -- vector( 24.800, 0.000, 0.000 ) -- vector( -1.000, 0.000, 0.000 )
See also
collisionData properties: modelA, modelB, pointOfContact, collisionNormal
collisionData methods: resolveA, resolveB
![]() ![]() ![]() |