Adobe ATMOSPHERE User Manual page 321

Table of Contents

Advertisement

getSolidObjectCount()
Returns the number of SolidObjects in the given SceneGroup.
chat.print("There are " + stage.solidObjectCount() + " SolidObject(s) in the scene.");
getSurfaceObject(index or name)
Returns the corresponding SurfaceObject at the given index or name that is contained by the SceneGroup.
theSurfaceObject = theStage.getSurfaceObject(0);
getSurfaceObjectCount()
Returns the number of SurfaceObjects in the given SceneGroup.
chat.print("There are " + stage.getSurfaceObject() + " SurfaceObject(s) in the scene.");
getViewpointObject(index or name)
Returns the corresponding ViewpointObject at the given index or name that is contained by the SceneGroup.
viewpointObject1 = theStage.getViewpointObject(0);
viewpointObject2 = theStage.getViewpointObject("sphere");
getViewpointObjectCount()
Returns the number of ViewpointObjects in the scene.
chat.print("There are " + stage.viewpointObjectCount()
+ " ViewpointObject(s) in the scene.");
createPhysicalModel(mass, inertiaScale)
A function that takes the SceneGroup's geometry and creates a PhysicalModel with the given mass. This is done
for all the pieces of the SceneGroup that don't already have PhysicalModels. Once created, the physical model
will modify the tranform of the SceneGroup as it experiences external forces, collisions and constraints.
For this version of the function, the physical model uses the full geometry of the SceneGroup, 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 '0' , in which case it will be fi xed in place, and will allow for more 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 beavoided 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.
box = SceneGroup("./box.aer").add();
box.timestep = function()
309
ADOBE ATMOSPHERE
User Guide

Advertisement

Table of Contents
loading

Table of Contents