3D Lingo Dictionary > L-N > modelB

 

modelB

Syntax

collisionData.modelB

Description

3D collisionData property; indicates one of the models involved in a collision, the other model being modelA.

The collisionData object is sent as an argument with the #collideWith and #collideAny events to the handler specified in the registerForEvent, registerScript, and setCollisionCallback commands.

The #collideWith and #collideAny events are sent when a collision occurs between models to which collision modifiers have been added. The resolve property of the models' modifiers must be set to TRUE.

This property can be tested but not set.

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 named MyScene collide, the #putDetails handler is called and the collisionData argument is sent to it. This handler displays the modelA and modelB properties of the collisionData object in the message window. The third part of the example shows the results from the message window. These show that the model named GreenBall was modelA and the model named YellowBall was modelB in the collision.

member("MyScene").registerForEvent(#collideAny, #putDetails, 0)
on putDetails me, collisionData
  put collisionData.modelA
  put collisionData.modelB
end
-- model("GreenBall")
-- model("YellowBall")

See also

registerScript(), registerForEvent(), sendEvent, modelA, collisionNormal, setCollisionCallback()