Adobe ATMOSPHERE User Manual page 384

Table of Contents

Advertisement

372
APPENDIX E
It should be noted that for any of the physics based constraints or actions, it is necessary to assignreasonable mass
values when creating the physical models so that physics processing does not become unstable(driven out of scope).
The guidelines for mass and inertia are decribed in the methodcreatePhysicalModel().
Properties
length
The resting length of the spring.
strength
The strength or stiffness of the constraint.
tau
The time constant for the constraint, similar to damping. (Note that reasonable values range from 0.0 to 1.0.)
Methods
setWorldSpacePivotPoints(Vector pivot1, Vector pivot2)
Sets the two points representing the ends of the spring. These points are in world space coordinates (i.e. they are
relative to the origin of the StageModel).
setLocalSpacePivotPoints(Vector pivot1, Vector pivot2)
Sets the two points representing the ends of the spring. These points are in local space coordinates (i.e. they are
relative to the origins of the corresponding SceneGroups specifi ed when the constraint was created).
Code Sample
box1 = SceneGroup("./box.aer").add();
box2 = SceneGroup("./box.aer").add();
loader = new Object();
loader.timestep = function()
{
if (box1.loaded && box2.loaded)
{
box1.physicalModel = box1.createPhysicalModel(10);
box2.physicalModel = box2.createPhysicalModel(2);
solver = FastConstraintSolver();
constraint = solver.createStiffSpringConstraint(box1.physicalModel,
constraint.length = 1.0;
constraint.strength = 1.0;
constraint.tau = 1.0;
pivot1 = Vector (0, 0, 0);
pivot2 = Vector (1, 0, 0)
constraint.setWorldSpacePivotPoints(pivot1, pivot2)
box2.physicalModel);

Advertisement

Table of Contents
loading

Table of Contents