Adobe ATMOSPHERE User Manual page 336

Table of Contents

Advertisement

324
APPENDIX E
receiveShadows
A boolean value that specifi es whether this object will receive shadows. This property requires that dynamic
lighting is enabled for the scene, and that the property 'useDynamicLighting' is set to 'true' .
SurfaceObject.receiveShadows = true;
visible
A boolean fl ag that sets if the SurfaceObject is visible or not. Default is true.
spider.visible = false; // Hide the spider for now
Methods
createPhysicalModel(mass, inertiaScale)
A function that takes the current SurfaceObject geometry and creates a physical model with the given mass.
Once created, the physical model will modify the tranform of the SurfaceObject object as it experiences external
forces, collisions and constraints.
For this version of the function, the physical model uses the full geometry of the SurfaceObject, 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 cubic 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 a mass of "8", since the volume of the box is 8 cubic 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 = boxSurfaceObject.createPhysicalModel(1, 1);
createConvexPhysicalModel(mass, inertiaScale)
A function that takes the current SurfaceObject 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 SurfaceObject object as it experiences external forces, collisions and
constraints.
For this version of the function, the physical model uses the convex hull of the SurfaceObject 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.

Advertisement

Table of Contents
loading

Table of Contents