ADOBE DIRECTOR 11.0
User Guide
418
Using the Physics (Dynamiks) Xtra
The Physics Xtra is a high-performance tool that helps developers create 3D worlds in which objects interact. The
Xtra performs calculations to determine the results of collisions, factoring in object properties such as mass, velocity,
and rotation. Forces can be applied, and objects can be connected to each other with constraints. The constraints
available are 6 degree of freedom joints, linear joints, angular joints, and spring joints.
Additionally, terrains and raycasting are supported. A terrain is similar to a bumpy plane that is infinite in two
dimensions and defines an elevation along the third. Raycasting is the mechanism of collision detection with rays.
Raycasting can be done against all types of rigid bodies and terrains.
With this Xtra, developers can focus on game play and user interaction, and not worry about creating a real-time
physics engine with Lingo scripts.
The Physics (dynamiks) Xtra is a fully integrated rigid body physics simulation engine for Adobe® Director®. The
dynamics Xtra is supported on Windows and MAC platforms.
The physics engine for Director has the following features. Refer to the rest of the chapter for their details.
Physics World
The physics scene is represented by a cast member that can be inserted using the Insert menu in Director (Insert >
Media Element > Physics.)
Initializing and stopping the physics scene simulation
The physics scene should be initialized using the init() method with a reference to the 3D world. The 3D world can
also be an imported w3d file. The physics scene should also be stopped at the end of the simulation using the
destroy() method.
The simulate method has to be called to advance the physics simulation. If an equal time-step is specified, the time
slice specified in the init() method will be used to advance time.
In the automatic mode, the actual lapsed time is used to advance time.
Sub-steps are provided for accuracy.
The co-ordinate system of the physics world is the same as the 3D World in Director, but for an imported w3d scene,
the co-ordinates will be that of the external modeling tool where the scene was created.
World Properties
The various properties supported are mentioned in the chapter. All properties for world are set to zero by default.
World Methods
You can use the methods in the physics world to enable and disable collision detection between rigid bodies.
The physics world has methods to create, delete, and retrieve the following objects:
•
Rigid Bodies
•
Terrains
•
6dof joints (6 degrees of freedom)
•
Springs
•
Linear Joint or Constraint.