Adobe ATMOSPHERE User Manual page 332

Table of Contents

Advertisement

320
APPENDIX E
solidObject.receiveShadows = true;
Methods
createPhysicalModel(mass, inertiaScale)
A function that takes the current SolidObject geometry and creates a physical model with the given mass. Once
created, the physical model will modify the tranform of the SolidObject object as it experiences external forces,
collisions and constraints.
For this version of the function, the physical model uses the full geometry of the SolidObject, which may
slow down the physics simulation if done for many complex objects. The one exception is if the physical
model is created with a mass of zero, in which case it will be fi xed in place, and will allow for effi cient collision
computations with other objects.
Mass is a relative scale, and a density index of "1" per square foot of geometric volume is a reasonable starting
point. For example, a box with thedimensions of [1x1x1] would be assigned a mass of "1". A box which is
[2x2x2] would be assigned amass of "8", since the volume of the box is 8 square feet. It should be noted that for
any of the physics based constraints or actions, there are conditions under which the physics processing may
become unstable. Exerting very large forces on very lightobjects may cause the calculations to be driven out
of scope(to infi nity). These conditions can be avoided by assigning reasonable mass values when creating the
physical models, as described above. The designer should experiment with mass values and forces applied to
insure that physics and javascript processing are not brought to a halt.
The inertia scale may be used to scale the moment of inertia of the object. Sometimes constraints may be made
more stable by scaling up the moments of inertia of the physical models that they affect.
boxPhysicalModel = boxSolidObject.createPhysicalModel(1, 1);
createConvexPhysicalModel(mass, inertiaScale)
A function that takes the current SolidObject geometry and creates a physical model with the given mass. The
inertia scale may be used to scale the moment of inertia of the object. Sometimes constraints may be made
more stable by scaling up the moments of inertia of the physical models that they affect. Once created, the
physical model will modify the tranform of the SolidObject object as it experiences external forces, collisions and
constraints.
For this version of the function, the physical model uses the convex hull of the SolidObject object, which allows
collisions to be much more effi ciently computed by the physics engine. Care should be given to following the
guidelines for mass and inertia values as described in createPhysicalModel() above.
boxPhysicalModel = boxSolidObject.createConvexPhysicalModel(1, 1);
getPhysicalModel()
Gets the PhysicalModel created by the above methods.
boxPhysicalModel = boxObject.getPhysicalModel();
deletePhysicalModel()
Deletes the PhysicalModel created by the above methods, and removes all associated physics processing.

Advertisement

Table of Contents
loading

Table of Contents