User Guide
862 Chapter 14: Properties
This statement stores a reference to the eighth model of the cast member named 3DWorld in the
variable thismodel.
thismodel = member("3DWorld").model[8]
This statement shows that there are four models in the member of sprite 1.
put sprite(1).member.model.count
-- 4
modelA
Usage
collisionData.modelA
Description
3D collisionData property; indicates one of the models involved in a collision, the other model
being
modelB.
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, modelB,
setCollisionCallback()