Adobe ATMOSPHERE User Manual page 306

Table of Contents

Advertisement

294
APPENDIX E
This unnecessary settling can be eliminated by setting the "active" state to "false". The objects will automatically
resume physics behavior at the next collision with another object, and this fl ag will automatically be returned to
"true".
This property should also be set to 'true' prior to specifying an acceleration or velocity of an object, since an
object at rest may be in a 'deactivated' state. (see comments regarding deactivation elsewhere on this page.)
for ( i=0 ; i<9 ; i++ )
{
bowlingPins[i].physicalModel.active = false;
}
collide
Determines if and how this SceneGroup collides with the world and other SceneGroups. If collide is true,
collisions with the world and other collidable SceneGroups are taken into account when calling moveTo() (i.e.,
the world and other objects can affect our position).
// Set the initial position without collisions
ball.position = startPosition;
// Henceforth, don't let the ball pass through things.
ball.collide = true;
// Schedule a move with collisions
ball.moveTo(endPosition);
fi xed
A boolean that fi xes an object in place to prevent physical motion. This fl ag speeds up collision detection for
other objects relative to just setting the velocity and acceleration to zero. If fi xed is false then the object will move
according to it's velocity, acceleration, angular velocity and angular accerelation taking collisions into account
depending on the value the of the collide property.
box = SceneGroup("./box.aer").add();
box.timestep = function()
{
if (this.loaded)
{
this.physicalModel = this.createPhysicalModel(10);
this.physicalModel.fi xed = true;
this.physicalModel.friction = .5;
this.physicalModel.inertiaScale = 1.5;
this.physicalModel.restitution = .6;
removeAnimator(this);
}
}
addAnimator(box);

Advertisement

Table of Contents
loading

Table of Contents