Photon Quantum 2.1.1

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Quantum.Physics3D.SpringJoint3D Struct Reference

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...
 
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...
 

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ SpringJoint3D()

Quantum.Physics3D.SpringJoint3D.SpringJoint3D ( FP  spring,
FP  damper,
FP  distance,
EntityRef  connectedEntity,
FPVector3  anchor,
FPVector3  connectedAnchor 
)
inline

Constructs a SpringJoint3D struct. Use CreateJoint overloads instead to create a Joint3D of type JointType3D.SpringJoint.

Returns

Member Function Documentation

◆ CreateJoint() [1/2]

static Joint3D Quantum.Physics3D.SpringJoint3D.CreateJoint ( FP  spring,
FP  damper,
FP  distance,
EntityRef  connectedEntity = default,
FPVector3  anchor = default,
FPVector3  connectedAnchor = default 
)
inlinestatic

Creates a Joint3D of type JointType3D.SpringJoint.

Parameters
springThe stiffness of the spring, in Newtons per meter (N/m).
damperThe damping capacity at which the spring oscillation is suppressed, in Newtons per square meter (N/m2).
distanceThe distance between the anchor points that the joint will attempt to maintain.
connectedEntityA 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.
anchorThe 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.
connectedAnchorIf 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.
Returns
A Joint3D of type JointType3D.SpringJoint.

◆ CreateJoint() [2/2]

static Joint3D Quantum.Physics3D.SpringJoint3D.CreateJoint ( FP  frequency,
FP  dampingRatio,
FP  distance,
PhysicsBody3D *  jointBody,
EntityRef  connectedEntity = default,
PhysicsBody3D *  connectedBody = null,
FPVector3  anchor = default,
FPVector3  connectedAnchor = default 
)
inlinestatic

Creates a Joint3D of type JointType3D.SpringJoint.

Parameters
frequencyThe 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.
dampingRatioA dimensionless value representing the damper capacity of suppressing the spring oscillation, typically between 0 and 1.
distanceThe distance between the anchor points that the joint will attempt to maintain.
jointBodyThe PhysicsBody3D component of the joint entity. The body mass affects the spring rate necessary to achieve the target oscillation frequency.
connectedEntityA 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.
connectedBodyThe 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.
anchorThe 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.
connectedAnchorIf 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.
Returns
A Joint3D of type JointType3D.SpringJoint.

◆ GetStiffness()

void Quantum.Physics3D.SpringJoint3D.GetStiffness ( PhysicsBody3D *  jointBody,
PhysicsBody3D *  connectedBody,
out FP  frequency,
out FP  dampingRatio 
)
inline

Computes the frequency and dampingRatio based on the joint Spring and Damper capacities, given the physics body(ies) involved.

Parameters
jointBodyThe PhysicsBody3D component of the joint entity. The body mass affects the resultant oscillation frequency, given the joint spring stiffness.
connectedBodyThe 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.
frequencyThe 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.
dampingRatioA dimensionless value representing the damper capacity of suppressing the spring oscillation, typically between 0 and 1.
Exceptions
NullReferenceExceptionIf the jointBody is null.

◆ SetStiffness()

void Quantum.Physics3D.SpringJoint3D.SetStiffness ( FP  frequency,
FP  dampingRatio,
PhysicsBody3D *  jointBody,
PhysicsBody3D *  connectedBody = null 
)
inline

Computes and sets the Spring and Damper capacities based on the target frequency and dampingRatio , given the physics body(ies) involved.

Parameters
jointBodyThe PhysicsBody3D component of the joint entity. The body mass affects the resultant oscillation frequency, given the joint spring stiffness.
connectedBodyThe 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.
frequencyThe 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.
dampingRatioA dimensionless value representing the damper capacity of suppressing the spring oscillation, typically between 0 and 1.
Exceptions
NullReferenceExceptionIf the jointBody is null.

◆ ComputeStiffness()

static void Quantum.Physics3D.SpringJoint3D.ComputeStiffness ( FP  frequency,
FP  dampingRatio,
PhysicsBody3D *  jointBody,
PhysicsBody3D *  connectedBody,
out FP  spring,
out FP  damper 
)
inlinestatic

Computes the spring and damper capacities based on the target frequency and dampingRatio , given the physics body(ies) involved.

Parameters
jointBodyThe PhysicsBody3D component of the joint entity. The body mass affects the resultant oscillation frequency, given the joint spring stiffness.
connectedBodyThe 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.
frequencyThe 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.
dampingRatioA dimensionless value representing the damper capacity of suppressing the spring oscillation, typically between 0 and 1.
Exceptions
NullReferenceExceptionIf the jointBody is null.

Member Data Documentation

◆ Anchor

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.

◆ ConnectedAnchor

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.

◆ ConnectedEntity

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.

◆ Spring

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.

◆ Damper

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.

◆ Distance

FP Quantum.Physics3D.SpringJoint3D.Distance

The distance between the anchor points that the joint will attempt to maintain.