A Joint3D that attaches a Physics Body to an anchor as if connected by a spring, trying to keep them a certain distance apart. The connected anchor can be a world-space position or another entity with at least a transform component. More...
Public Member Functions | |
SpringJoint3D (FP spring, FP damper, FP distance, EntityRef connectedEntity, FPVector3 anchor, FPVector3 connectedAnchor) | |
Constructs a SpringJoint3D struct. Use CreateJoint overloads instead to create a Joint3D of type JointType3D.SpringJoint. More... | |
override int | GetHashCode () |
Overrides the hash code generation of this type. More... | |
void | GetStiffness (PhysicsBody3D *jointBody, PhysicsBody3D *connectedBody, out FP frequency, out FP dampingRatio) |
Computes the frequency and dampingRatio based on the joint Spring and Damper capacities, given the physics body(ies) involved. More... | |
void | SetStiffness (FP frequency, FP dampingRatio, PhysicsBody3D *jointBody, PhysicsBody3D *connectedBody=null) |
Computes and sets the Spring and Damper capacities based on the target frequency and dampingRatio , given the physics body(ies) involved. More... | |
Static Public Member Functions | |
static void | ComputeStiffness (FP frequency, FP dampingRatio, PhysicsBody3D *jointBody, PhysicsBody3D *connectedBody, out FP spring, out FP damper) |
Computes the spring and damper capacities based on the target frequency and dampingRatio , given the physics body(ies) involved. More... | |
static Joint3D | CreateJoint (FP frequency, FP dampingRatio, FP distance, PhysicsBody3D *jointBody, EntityRef connectedEntity=default, PhysicsBody3D *connectedBody=null, FPVector3 anchor=default, FPVector3 connectedAnchor=default) |
Creates a Joint3D of type JointType3D.SpringJoint. More... | |
static Joint3D | CreateJoint (FP spring, FP damper, FP distance, EntityRef connectedEntity=default, FPVector3 anchor=default, FPVector3 connectedAnchor=default) |
Creates a Joint3D of type JointType3D.SpringJoint. More... | |
static void | Serialize (void *ptr, FrameSerializer serializer) |
Serializes a SpringJoint3D into a FrameSerializer. More... | |
Public Attributes | |
FPVector3 | Anchor |
The anchor offset, in the local space of the joint entity transform. This is the point considered for the joint constraints and where the joint forces are applied. More... | |
FPVector3 | ConnectedAnchor |
If the joint has a ConnectedEntity, this represents the anchor offset relative to it, in local space. Else, this is the position in world space considered as target anchor. More... | |
EntityRef | ConnectedEntity |
A target entity that this joint might be connected to. If set to EntityRef.None, the ConnectedAnchor represents the target anchor position in world space. The connected entity must have at least a Transform3D component. If it also has a non-kinematic PhysicsBody3D, joint forces are also computed and applied to it. More... | |
FP | Damper |
The damper capacity at which the spring oscillation is suppressed, in Newtons per square meter (N/m2). To get or set the damping RATIO, given the physics body(ies) involved, use GetStiffness and SetStiffness, respectively. More... | |
FP | Distance |
The distance between the anchor points that the joint will attempt to maintain. More... | |
FP | Spring |
The stiffness of the spring, in Newtons per meter (N/m). To get or set the frequency (Hz) at which the spring will attempt to oscillate, given the physics body(ies) involved, use GetStiffness and SetStiffness, respectively. More... | |
Static Public Attributes | |
const int | SIZE = FPVector3.SIZE * 2 + EntityRef.SIZE + FP.SIZE * 3 |
The size of the struct in bytes. More... | |
A Joint3D that attaches a Physics Body to an anchor as if connected by a spring, trying to keep them a certain distance apart. The connected anchor can be a world-space position or another entity with at least a transform component.
|
inline |
Constructs a SpringJoint3D struct. Use CreateJoint overloads instead to create a Joint3D of type JointType3D.SpringJoint.
|
inlinestatic |
Creates a Joint3D of type JointType3D.SpringJoint.
spring | The stiffness of the spring, in Newtons per meter (N/m). |
damper | The damping capacity at which the spring oscillation is suppressed, in Newtons per square meter (N/m2). |
distance | The distance between the anchor points that the joint will attempt to maintain. |
connectedEntity | A target entity that this joint might be connected to. If set to EntityRef.None, the ConnectedAnchor represents the target anchor position in world space. The connected entity must have at least a Transform3D component. If it also has a non-kinematic PhysicsBody3D, joint forces are also computed and applied to it. |
anchor | The anchor offset, in the local space of the joint entity transform. This is the point considered for the joint constraints and where the joint forces are applied. |
connectedAnchor | If the joint has a ConnectedEntity, this represents the anchor offset relative to it, in local space. Else, this is the position in world space considered as target anchor. |
|
inlinestatic |
Creates a Joint3D of type JointType3D.SpringJoint.
frequency | The frequency in Hertz (Hz) at which the spring joint will attempt to oscillate, given the mass of the body(ies) involved. Typical values are below half the frequency of the simulation. |
dampingRatio | A dimensionless value representing the damper capacity of suppressing the spring oscillation, typically between 0 and 1. |
distance | The distance between the anchor points that the joint will attempt to maintain. |
jointBody | The PhysicsBody3D component of the joint entity. The body mass affects the spring rate necessary to achieve the target oscillation frequency. |
connectedEntity | A target entity that this joint might be connected to. If set to EntityRef.None, the ConnectedAnchor represents the target anchor position in world space. The connected entity must have at least a Transform3D component. If it also has a non-kinematic PhysicsBody3D, joint forces are also computed and applied to it. |
connectedBody | The PhysicsBody3D component of the connectedEntity , if it exists and has one. Can be null , in which case the spring/damper rates will be computed as if the joint is connected to a fixed point or kinematic body. |
anchor | The anchor offset, in the local space of the joint entity transform. This is the point considered for the joint constraints and where the joint forces are applied. |
connectedAnchor | If the joint has a ConnectedEntity, this represents the anchor offset relative to it, in local space. Else, this is the position in world space considered as target anchor. |
|
inline |
Computes the frequency and dampingRatio based on the joint Spring and Damper capacities, given the physics body(ies) involved.
jointBody | The PhysicsBody3D component of the joint entity. The body mass affects the resultant oscillation frequency, given the joint spring stiffness. |
connectedBody | The PhysicsBody3D component of the entity connected to the joint, if it exists and has one. Can be null , in which case the frequency and damping ratio will be computed as if the joint is connected to a fixed point or kinematic body. |
frequency | The frequency in Hertz (Hz) at which the spring joint will attempt to oscillate, given the mass of the body(ies) involved. Typical values are below half the frequency of the simulation. |
dampingRatio | A dimensionless value representing the damper capacity of suppressing the spring oscillation, typically between 0 and 1. |
NullReferenceException | If the jointBody is null . |
|
inline |
Computes and sets the Spring and Damper capacities based on the target frequency and dampingRatio , given the physics body(ies) involved.
jointBody | The PhysicsBody3D component of the joint entity. The body mass affects the resultant oscillation frequency, given the joint spring stiffness. |
connectedBody | The PhysicsBody3D component of the entity connected to the joint, if it exists and has one. Can be null , in which case the frequency and damping ratio will be computed as if the joint is connected to a fixed point or kinematic body. |
frequency | The frequency in Hertz (Hz) at which the spring joint will attempt to oscillate, given the mass of the body(ies) involved. Typical values are below half the frequency of the simulation. |
dampingRatio | A dimensionless value representing the damper capacity of suppressing the spring oscillation, typically between 0 and 1. |
NullReferenceException | If the jointBody is null . |
|
inlinestatic |
Computes the spring and damper capacities based on the target frequency and dampingRatio , given the physics body(ies) involved.
jointBody | The PhysicsBody3D component of the joint entity. The body mass affects the resultant oscillation frequency, given the joint spring stiffness. |
connectedBody | The PhysicsBody3D component of the entity connected to the joint, if it exists and has one. Can be null , in which case the frequency and damping ratio will be computed as if the joint is connected to a fixed point or kinematic body. |
frequency | The frequency in Hertz (Hz) at which the spring joint will attempt to oscillate, given the mass of the body(ies) involved. Typical values are below half the frequency of the simulation. |
dampingRatio | A dimensionless value representing the damper capacity of suppressing the spring oscillation, typically between 0 and 1. |
NullReferenceException | If the jointBody is null . |
|
inlinestatic |
Serializes a SpringJoint3D into a FrameSerializer.
ptr | The pointer to the SpringJoint3D. |
serializer | The FrameSerializer instance into which the struct will be serialized. |
|
inline |
Overrides the hash code generation of this type.
|
static |
The size of the struct in bytes.
FPVector3 Quantum.Physics3D.SpringJoint3D.Anchor |
The anchor offset, in the local space of the joint entity transform. This is the point considered for the joint constraints and where the joint forces are applied.
FPVector3 Quantum.Physics3D.SpringJoint3D.ConnectedAnchor |
If the joint has a ConnectedEntity, this represents the anchor offset relative to it, in local space. Else, this is the position in world space considered as target anchor.
EntityRef Quantum.Physics3D.SpringJoint3D.ConnectedEntity |
A target entity that this joint might be connected to. If set to EntityRef.None, the ConnectedAnchor represents the target anchor position in world space. The connected entity must have at least a Transform3D component. If it also has a non-kinematic PhysicsBody3D, joint forces are also computed and applied to it.
FP Quantum.Physics3D.SpringJoint3D.Spring |
The stiffness of the spring, in Newtons per meter (N/m). To get or set the frequency (Hz) at which the spring will attempt to oscillate, given the physics body(ies) involved, use GetStiffness and SetStiffness, respectively.
FP Quantum.Physics3D.SpringJoint3D.Damper |
The damper capacity at which the spring oscillation is suppressed, in Newtons per square meter (N/m2). To get or set the damping RATIO, given the physics body(ies) involved, use GetStiffness and SetStiffness, respectively.
FP Quantum.Physics3D.SpringJoint3D.Distance |
The distance between the anchor points that the joint will attempt to maintain.