Adds a shape to the body. A shape may not be added to the body after it has been added to a Prism.
The shape to add.
default = VEC3_ZERO
Offset from the body's location to place the shape.
default = QUAT_IDENTITY
Rotation of the shape relative to the body's orientation.
Id of the shape for the body. INVALID_PHYSICS_ID if the shape was not added.
Applies a force to the body. The force will only be applied for the current frame; to apply a continuous force, this function must be called every frame.
Type of force to apply (force or impulse).
Amount of force. Units depend on the force type.
Applies a force to the body at a given position. If the force is not at the center of mass, this will result in a torque being applied to the body as well. Both the force and position are in volume-space reference frame. The force will only be applied for the current frame; to apply a continuous force, this function must be called every frame.
Type of force to apply (force or impulse).
Amount of force. Units depend on the force type.
Position to apply the force
Applies a force to the body at a given position. If the force is not at the center of mass, this will result in a torque being applied to the body as well. Both the force and position are in local-space of the body reference frame. The force will only be applied for the current frame; to apply a continuous force, this function must be called every frame.
Type of force to apply (force or impulse).
Amount of force. Units depend on the force type.
Position to apply the force
Applies a torque to the body. The torque will only be applied for the current frame; to apply a continuous torque, this function must be called every frame.
Type of torque to apply (force or impulse).
Amount of torque. Units depend on the force type.
Clears a single collider flag for the body.
Collider flag, in the range of 0 - 31.
Clears a single collides with flag for the body.
Collides with flag, in the range of 0 - 31.
Clears all linear forces on the body.
Clears all angular forces on the body.
Returns angular damping coefficient being applied to the body.
Damping
Returns the angular velocity of the body, in rad/sec.
velocity
Returns the rigid body type (static/kinematic/dynamic).
The body type.
Returns the center of mass of the body.
Center of mass.
Returns the collider flags for the body.
The collider flags.
Returns the collides with flags for the body.
The collides with flags.
Returns the inertia tensor of the body.
Inertia tensor.
Returns linear damping coefficient being applied to the body.
Damping
Returns the linear velocity of the body, in meter/sec.
velocity
Returns the mass of the rigid body.
Mass, in kilograms.
Returns the maximum angular velocity of the body.
Max velocity
Returns the sleep threshold of the body.
Threshold
Returns if a given collider flag is set.
Flag value, in the range of 0 - 31.
true if the flag is set.
Returns if a given collides with flag is set.
Flag value, in the range of 0 - 31.
true if the flag is set.
Get the Node this RigidBody is attached to.
the Node pointer.
Removes a shape from the body. A shape may not be removed from the body after it has been added to a Prism.
Id of the shape to remove.
true if the shape was removed
Sets angular damping coefficient being applied to the body. This can be used to simulate things like rolling friction.
Damping coefficient
Sets the angular velocity of the body, in rad/sec.
Sets the rigid body type (static/kinematic/dynamic). Changing this may result in the loss of data for the body in the simulation. The preferred way to change the body type is to remove the body from its volume, change the type, and re-add to the volume.
The body type.
Sets the center of mass of the body. Note setting it outside the body's area as defined by the shapes attached to it may result in an unstable simulation.
Center of mass
Sets a single collider flag for the body.
Collider flag, in the range of 0 - 31.
Sets the collider flags for the body. If the collider flags of one body anded with the collides with flags of another body is 0, the bodies will not collide.
Collider flags.
Sets a single collides with flag for the body.
Collides with flag, in the range of 0 - 31.
Sets the collides with flags for the body. If the collider flags of one body anded with the collides with flags of another body is 0, the bodies will not collide.
Collides with flags.
Enable/disable continuous collision detection (CCD) for this body. Enabling CCD can be used to prevent a body from "tunneling" through another due to it moving too fast.
IMPORTANT: Physics must have been enabled with the solverType initialization data set to kFastNormal or kFastFast for this to have an effect.
Flag to enable CCD on the body.
Flags the body as ignoring gravity.
If true, the body won't be affected by gravity.
Sets the inertia tensor of the body. A value of 0 is the equivalent of infinite inertia on the axis.
Inertia tensor.
Sets linear damping coefficient being applied to the body. This can be used to simulate things like air resistance.
Damping coefficient
Sets the linear velocity of the body, in meter/sec.
Sets the mass of the rigid body.
Mass, in kilograms. Must be > 0.
Sets the maximum angular velocity of the body. This helps keep the simulation stable; it can become unstable if the object rotates too fast.
Max velocity
Sets the sleep threshold of the body. This controls when the body is marked to be stopped simulating due to lack of motion.
Sleep threshold value
Generated using TypeDoc
Defines the mass and movement properties of a physics object. A rigid body has no inherent shape, one or more PhysicsShapes need to be added to it.
A rigid body is one of 3 types: static, kinematic, or dynamic static : The body never moves. kinematic : The body can be moved by external systems, such as animation, but is not affected by forces or collisions. dynamic : The body is affected by forces and collisions.
It is important that apart from their initial position, static and dynamic bodies should not have their positions changed by calls to setLocalPosition, etc. This will cause unexpected results in the simulation.