What's New in Director 8.5 > Working with Models and Model Resources > Modifiers > Collision modifier properties

 

Collision modifier properties

The collision modifier allows a model to be notified of and respond to collisions. You can access a model's collision modifier properties using syntax such as model.collision.whichProperty.

Detecting collisions and responding to collisions are separate tasks. If the enabled property is set to TRUE, and a script has been registered to be notified of collisions using the setCollisionCallback() method, that Lingo script instance receives a callback. However, the collision isn't resolved unless the resolve property is also set to TRUE.

This separation is deliberate and valuable: it can be important for a collision to be registered. In a game, for example, a projectile could strike a wall and the player's score could be incremented. In that same game, however, you might not want the projectile to bounce off the wall. In that case, you'd set the enabled property to TRUE and set the resolve property to FALSE.

Use these properties to work with the collision modifier:

Property

Access

Description

Default

whichModel.collision.enabled

Get and set

TRUE (1) or FALSE (0) value indicating whether collisions between this model and other models will trigger a collision event.

TRUE (1)

whichModel.collision.resolve

Get and set

TRUE (1) or FALSE (0) value indicating whether collisions are automatically resolved. If the value is TRUE (1) and if the other model has the collision modifier applied and has enabled set to TRUE (1), the models will be moved back to the position of their original contact.

TRUE (1)

whichModel.collision.immovable

Get and set

TRUE (1) or FALSE (0) value indicating whether the model can be moved. If a model cannot be moved, the 3D Xtra can save time by not checking it for collisions with other models that also have their immovable property set to TRUE.

FALSE (0)