Adds physics motion to an entity with a PhysicsCollider3D driven by the built-in physics systems. You can customize how the movement of the physics body will works by changing the Mass, GravityScale or Drag. A Kinematic body will not have linear and angular velocities integrated, but those values are still perceived and taken into account when resolving the collision with other dynamic bodies. More...
Public Types | |
enum | ConfigFlags : byte |
The flags to set up how the physics body will behave in the physics systems. More... | |
Public Member Functions | |
void | AddAngularImpulse (FPVector3 amount) |
Accumulates a given amount of angular impulse, to be integrated into angular velocity on the next Physics Update. The amount of delta angular velocity produced by the angular impulse is inversely proportional to the body inertia on each axis. More... | |
void | AddForce (FPVector3 amount, FPVector3? relativePoint=null) |
Increases the Force value with the amount vector. The force is integrated into delta velocity on the next Physics Update. The amount of delta-velocity produced by the accumulated force is directly proportional do the delta-time and inversely proportional do the Mass of the body. If the impulse is applied at a relativePoint that is different than zero, it will also generate Torque. More... | |
void | AddForceAtPosition (FPVector3 force, FPVector3 position, Transform3D *transform) |
Applies the given force to the body at a given position in world space. More... | |
void | AddForceAtPosition (FPVector3 force, FPVector3 position, Transform3D transform) |
void | AddLinearImpulse (FPVector3 amount, FPVector3? relativePoint=null) |
Applies the given amount of linear impulse to the body. The amount of delta-velocity generated by the impulse is inversely proportional to the mass of the body. If the impulse is applied in a relativePoint that is different than zero, it will also generate a delta angular velocity. More... | |
void | AddLinearImpulseAtPosition (FPVector3 impulse, FPVector3 position, Transform3D *transform) |
Applies the given linear impulse to the body at a given position in world space. More... | |
void | AddLinearImpulseAtPosition (FPVector3 impulse, FPVector3 position, Transform3D transform) |
void | AddTorque (FPVector3 amount) |
Accumulates a given amount of torque, to be integrated into angular velocity on the next Physics Update. The amount of delta angular velocity produced by the angular impulse is directly proportional to the Update delta-time and inversely proportional to the body inertia on each axis. More... | |
void | ClearForce () |
Clears all the accumulated forces in this body. More... | |
void | ClearTorque () |
Clears all the accumulated torques in this body. More... | |
FPVector3 | GetInertiaTensor () |
Returns the inertia tensor based on the stored inverse inertia tensor values. More... | |
FPVector3 | GetPointVelocity (FPVector3 point, Transform3D *bodyTransform) |
Computes the velocity of the physics body at a given point defined in world space. More... | |
FPVector3 | GetRelativePointVelocity (FPVector3 point, Transform3D *bodyTransform) |
Computes the velocity of the physics body at a given point defined on its local space. More... | |
void | InitBody (FP bodyMass, FP drag, FP angularDrag, ConfigFlags bodyConfig, RotationFreezeFlags rotationFlags, FPVector3? centerOfMass=null, NullableFP gravityScale=default) |
Initializes a PhysicsBody3D component with custom settings. More... | |
void | ResetCenterOfMass (FrameBase f, EntityRef entity) |
Resets the CenterOfMass of physics body component to the the shape centroid of a PhysicsCollider3D component attached to the entity . More... | |
void | ResetInertia (FrameBase frame, EntityRef entity) |
Resets the inertia on this physics body component based on its mass and the shape of a PhysicsCollider3D component on the entity . More... | |
void | SetInertiaTensor (FPVector3 inertiaTensor) |
Sets the inertia tensor value. The greater the value of inertia on a given axis, the more torque will be required to achieve the same delta angular velocity on that axis. This value is automatically recomputed when the value of mass is set. More... | |
void | Sleep () |
Puts an enabled physics body into a sleeping state. More... | |
void | WakeUp () |
Wakes up a sleeping physics body and resets the accumulated time within sleeping thresholds. More... | |
Static Public Member Functions | |
static PhysicsBody3D | CreateDynamic (FP mass, FP drag, FP angularDrag, Boolean allowSleeping, Boolean awakenByKinematics=false, RotationFreezeFlags flags=default, FPVector3? centerOfMass=null, NullableFP gravityScale=default) |
Creates a dynamic PhysicsBody3D. More... | |
static PhysicsBody3D | CreateDynamic (FP mass, FP drag=default, FP angularDrag=default, ConfigFlags bodyConfig=ConfigFlags.Default, RotationFreezeFlags flags=default, FPVector3? centerOfMass=null, NullableFP gravityScale=default) |
static PhysicsBody3D | CreateKinematic () |
Creates a kinematic PhysicsBody3D. The mass, drag and angular drag are not considered in kinematic interactions and have 0 as value. More... | |
static void | Serialize (void *ptr, FrameSerializer serializer) |
Serializes a PhysicsBody3D into a FrameSerializer. More... | |
Public Attributes | |
FPVector3 | AngularVelocity |
The rate of change of physics rotation in radians per second for each axis. More... | |
RotationFreezeFlags | RotationFreeze |
The RotationFreezeFlags that blocks the rotation in the specified axes. More... | |
FPVector3 | Velocity |
The rate of change of physics body position in units per second. More... | |
Static Public Attributes | |
const int | SIZE = FirstVector3 + FPVector3.SIZE * 4 |
The size of the component (or struct/type) in-memory inside the Frame data-buffers or stack (when passed as value parameter). Not related to the snapshot payload this occupies, which is bit-packed and compressed. More... | |
Properties | |
Boolean? | AllowSleeping [get, set] |
FP | AngularDrag [get, set] |
FPVector3 | CenterOfMass [get, set] |
FP | Drag [get, set] |
Boolean? | Enabled [get, set] |
FPVector3 | Force [get] |
The accumulated forces by the AddForce method that will be integrated into delta velocity on the next Physics Update. This value is reset after the integration. More... | |
FP | GravityScale [get, set] |
Boolean? | IsAwakenedByKinematics [get, set] |
Boolean? | IsKinematic [get, set] |
Boolean | IsSleeping [get] |
FP?? | Mass [get, set] |
FP? | MassInverse [get, set] |
FPVector3 | Torque [get] |
The accumulated torques by the AddTorque method that will be integrated into delta angular velocity on the next Physics Update. This value is reset after the integration. More... | |
Boolean? | UseContinuousCollisionDetection [get, set] |
Adds physics motion to an entity with a PhysicsCollider3D driven by the built-in physics systems. You can customize how the movement of the physics body will works by changing the Mass, GravityScale or Drag. A Kinematic body will not have linear and angular velocities integrated, but those values are still perceived and taken into account when resolving the collision with other dynamic bodies.
|
inline |
Returns the inertia tensor based on the stored inverse inertia tensor values.
|
inline |
Sets the inertia tensor value. The greater the value of inertia on a given axis, the more torque will be required to achieve the same delta angular velocity on that axis. This value is automatically recomputed when the value of mass is set.
|
inlinestatic |
Creates a kinematic PhysicsBody3D. The mass, drag and angular drag are not considered in kinematic interactions and have 0 as value.
Resets the inertia on this physics body component based on its mass and the shape of a PhysicsCollider3D component on the entity .
This is called automatically when a PhysicsBody3D component is added to an entity, unless the body ConfigFlags.ResetInertiaOnAdded flag is not set. The body's center of mass affects the computation of the inertia, so consider calling ResetCenterOfMass before resetting the inertia, specially if the collider shape has changed. More info on the online docs here.
frame | Current frame instance in use. |
entity | The entity from which the collider shape will be retrieved, necessary for computing the inertia. |
Resets the CenterOfMass of physics body component to the the shape centroid of a PhysicsCollider3D component attached to the entity .
This is called automatically when a PhysicsBody3D component is added to an entity, unless the body ConfigFlags.ResetCenterOfMassOnAdded flag is not set. When changing the collider shape in runtime, consider resetting the center of mass and inertia of the attached physics body, in this order. More info on the online docs here.
f | Current frame instance in use. |
entity | The entity from which the collider component and shape will be retrieved. |
|
inline |
Applies the given amount of linear impulse to the body. The amount of delta-velocity generated by the impulse is inversely proportional to the mass of the body. If the impulse is applied in a relativePoint that is different than zero, it will also generate a delta angular velocity.
amount | The impulse vector to be applied. |
relativePoint | A vector in world space that represents the distance from the center of mass to the point where the impulse is being applied. |
|
inline |
Applies the given linear impulse to the body at a given position in world space.
impulse | The impulse vector to be applied. |
position | The point in world space where the impulse is being applied. This position should be withing the collider shape in order to prevent unrealistic behavior. |
transform | The current transform of the entity that owns this physics body. |
|
inline |
Accumulates a given amount of angular impulse, to be integrated into angular velocity on the next Physics Update. The amount of delta angular velocity produced by the angular impulse is inversely proportional to the body inertia on each axis.
amount | The angular impulse to be accumulated. |
|
inline |
Clears all the accumulated forces in this body.
Increases the Force value with the amount vector. The force is integrated into delta velocity on the next Physics Update. The amount of delta-velocity produced by the accumulated force is directly proportional do the delta-time and inversely proportional do the Mass of the body. If the impulse is applied at a relativePoint that is different than zero, it will also generate Torque.
amount | The force vector in world coordinates. |
relativePoint | A vector in world space that represents the distance from the center of mass to the point where the impulse is being applied. |
|
inline |
Applies the given force to the body at a given position in world space.
force | The force vector to be applied. |
position | The point in world space where the impulse is being applied. This position should be withing the collider shape in order to prevent unrealistic behavior. |
transform | The current transform of the entity that owns this physics body. |
|
inline |
Clears all the accumulated torques in this body.
|
inline |
Accumulates a given amount of torque, to be integrated into angular velocity on the next Physics Update. The amount of delta angular velocity produced by the angular impulse is directly proportional to the Update delta-time and inversely proportional to the body inertia on each axis.
amount | The torque to be accumulated. |
|
inline |
Computes the velocity of the physics body at a given point defined in world space.
point | The point where the velocity will be computed at, in world space. |
bodyTransform | The transform component of the entity to which this physics body belongs. |
|
inline |
Computes the velocity of the physics body at a given point defined on its local space.
point | The point where the velocity will be computed at, in local space. |
bodyTransform | The transform component of the entity to which this physics body belongs. |
|
inline |
Wakes up a sleeping physics body and resets the accumulated time within sleeping thresholds.
|
inline |
Puts an enabled physics body into a sleeping state.
If set during a physics collision callback, the body might be awakened by the solver if the collision is not ignored.
|
inlinestatic |
Serializes a PhysicsBody3D into a FrameSerializer.
ptr | The pointer to the PhysicsBody3D. |
serializer | The FrameSerializer instance into which the struct will be serialized. |
|
static |
The size of the component (or struct/type) in-memory inside the Frame data-buffers or stack (when passed as value parameter). Not related to the snapshot payload this occupies, which is bit-packed and compressed.
RotationFreezeFlags Quantum.PhysicsBody3D.RotationFreeze |
The RotationFreezeFlags that blocks the rotation in the specified axes.
FPVector3 Quantum.PhysicsBody3D.Velocity |
The rate of change of physics body position in units per second.
FPVector3 Quantum.PhysicsBody3D.AngularVelocity |
The rate of change of physics rotation in radians per second for each axis.
|
get |
The accumulated forces by the AddForce method that will be integrated into delta velocity on the next Physics Update. This value is reset after the integration.