<physical> ‐ Physical properties
This element defines physical properties of objects. It defines an initial location and an initial impulse that will be used for calculating the location of the object at each frame.
The float value of the mass attribute defines the mass of the object.
The float values of the x_phys, y_phys, and z_phys attributes define the coordinates of the initial location of the object in its coordinate system. Since the scene graph transformations are used to compute the location of the object in the world coordinates, these values should normally be set to 0. They are automatically modified after a drag and drop interaction is performed or through physical interactions (collisions).
The float values of the yaw_phys, pitch_phys, and roll_phys attributes define the rotation angles of the initial location of the object in its coordinate system. (see Figure 5-4 for the definition of these angles with respect to the axes of the coordinate system).
The float values of the dx_phys, dy_phys, and dz_phys attributes define the coordinates of the initial linear impulse of the object in its coordinate system. If it is not null, and if the object has no physical interaction, the object will move with a constant speed.
The float values of the axis1, axis2, and axis3 attributes, define the coordinates of axis around which the object has an initial rotation in its coordinate system. The initial angular speed is given by the value of the attribute angular_speed. If it is not null, and if the object has no physical interaction, the object will rotate around the axis with a constant angular speed.
The float values of the x_drag, y_drag, and z_drag attributes define the temporary translation of the object in the object coordinate system during dragging (it cumulates the local translation stored in the *_phys attributes and the local translation due to dragging). Their value is null at the beginning of object dragging, and is updated at each frame. When a drag and drop action is completed, their final value is reported to the x_phys, y_phys, and z_phys attributes. These values can be modified to control object motion while dragging.
None.
The example below defines a sphere of mass 1.0, located at the origin of its coordinate system, with an initial vertical speed equal to (0,1,0) and an angular speed of 10 degrees by time unit around the object's z axis.
<node id="sphere_1"> <physical mass="1.0" x_phys="0.0" y_phys="0.0" z_phys="0.0" dx_phys="0." dy_phys="1.0" dz_phys="0." yaw_phys="0.0" pitch_phys="0.0" roll_phys="0.0" axis1="0." axis2="0." axis3="1.0" angular_speed="10" /> <sphere id="sphere_1_nightsky" radius="1.0"> <texture encoding="jpeg" xlink:href="texture.jpg" id="sky"/> </sphere> </node>
The values of the physical attributes of an object can be accessed through variable referencing by the sequence node:attribute in which node is the node ID and attribute is the physical attribute of the object.
Unless they are shadowed by explicit variables with the same names, the values of the attributes are accessed through the same syntax as variable referencing. For instance, the expression {$bird:x_phys},{$bird:y_phys},{$bird:z_phys}) is a list of three values that corresponds to the three coordinates of the node bird in its coordinate system. The example below accesses the attributes that define the location of the object named bird in its coordinate system:
<set_node_table_value id="relativePhysLoc" value="({$bird:x_phys},{$bird:y_phys},{$bird:z_phys})" operator="="/>