User Guide
362 APPENDIX E
MagneticAction
The “MagneticAction” simulates the effect of magnetic attraction or repulsion on physical models. The action is
created by a method of the “FastConstraintSolver”, and the source position of the effect is specifi ed as a vector. The
effect may be applied to as many SceneGroups as desired using the “addPhysicalModel(modelName)” method.
Note that only three of the properties may be modifi ed following the creation of the Magnetic Action; “active”,
“falloff”, “strength”. All other properties are specifi ed at creation time only, and remain constant (affected properties
are noted below for convenience.)
It should be noted that for any of the physics based constraints or actions, it is necessary to assign reasonable 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 method createPhysicalModel().
Properties
active
A boolean fl ag controlling whether the magnetic effect is currently processed. (default = true)
magneticAction.active = true;
angle
The cone angle around which the magnetic effect will be experienced (specifi ed in Radians).
[Note: this property is specifi ed at creation time only, and remains constant.]
angle = (2.0 * 3.1415927);
falloff
Specifi es the rate at which the magnetic forces will decrease with distance.
magneticAction.falloff = 0;
direction
The direction the magnetic force is aimed (as a Vector). Note that this value only has meaning if the “angle”
property (described above) is reduced from 360 degrees (specifi ed in radians).
[Note: this property is specifi ed at creation time only, and remains constant.]
direction = Vector( 0.0, 0.0, -1.0 ); //straight away in “Z”
maxDistance
The distance beyond which no magnetic force is experienced (specifi ed in feet).
[Note: this property is specifi ed at creation time only, and remains constant.]
maxDistance = 100;
position
The source position of the the magnetic force (as a Vector).
[Note: this property is specifi ed at creation time only, and remains constant.]
magCenter = theStage.getPrimitive(“magCenter”);










