phent_setmass (
ENTITY* entity, var mass, var hulltype );
Sets the entity's physical mass. A definition of mass is "resistance to change
in velocity".
Thus by increasing an object's
mass you will have to use a stronger force (or torque) to make them move,
or to stop them from moving.
Parameters:
entity
Entity to be affected
mass
Mass of the object
in kilograms, or 0 for a fixed object
hulltype
Shape of this object defining its rotational behavior: PH_SPHERE,
PH_BOX,
PH_CYLINDER, or PH_POLY.
Returns:
1 if successful, 0 otherwise.
Remarks:
To be consistent with standards you should use kilograms as the unit
of mass. The conversion factor from pounds (on Earth) to kilograms
is 1 lb. = 0.45 kg. The smallest mass you can specify is 0.001. When
setting
mass to 0, you will have a fixed object. This means that
the object won’t move under any circumstances, making it an ideal
choice for “anchors” to
connect other objects to.
An object's hull type determines its resistance
to torque and thus the way it rotates. You can use one of the predefined
constants to use an approximation of the object's shape or use PH_POLY to
deduce the actual shape.
The hull type specified with phent_setmass does not affect
the collision detection. Use phent_settype to
change the collision hull. phent_setmass only affects how
the object rotates along different axes when a torque is applied.
A sphere will resist rotation along all axes
in the same way, whereas a cylinder has a preferred axis. When specifying PH_POLY,
phent_setmass will calculate an accurate inertia tensor for
the polyhedron.
For stability reasons it is recommended to use PH_SPHERE whenever
possible.