Photon Quantum 3.0.0

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

A Joint3D that attaches a Physics Body to an anchor around which it can rotate. The connected anchor can be a world-space position or another entity with at least a transform component. The rotation can happen freely or, optionally, with limiting angles and/or a motor torque. More...

Public Member Functions

 HingeJoint3D (FrameBase f, EntityRef jointEntity, FPVector3 axis, NullableFP lowerLimitRad, NullableFP upperLimitRad, NullableFP motorSpeed, NullableFP maxMotorTorque, EntityRef connectedEntity, FPVector3 anchor, FPVector3 connectedAnchor)
 Constructs a HingeJoint3D struct. Use CreateJoint instead to create a Joint3D of type JointType3D.HingeJoint. More...
 
override int GetHashCode ()
 Overrides the hash code generation of this type. More...
 
void SetAxis (FrameBase f, EntityRef jointEntity, FPVector3 axis, bool resetRelRotRef=false)
 Sets the Axis around which the joint rotates, defined in the local space of the entity. More...
 

Static Public Member Functions

static Joint3D CreateJoint (FrameBase f, EntityRef jointEntity, FPVector3 axis, NullableFP lowerLimitRad, NullableFP upperLimitRad, NullableFP motorSpeed, NullableFP maxMotorTorque, EntityRef connectedEntity=default, FPVector3 anchor=default, FPVector3 connectedAnchor=default)
 Creates a Joint3D of type JointType3D.HingeJoint. More...
 
static void Serialize (void *ptr, FrameSerializer serializer)
 Serializes a HingeJoint3D 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 LowerLimitRad
 The lower angle of the allowed arc of rotation around the connected anchor, in radians. Set UseAngleLimits to enable or disable the angle-limiting constraints. More...
 
FP MaxMotorTorque
 The maximum torque produced by the hinge motor in order to achieve the target MotorSpeed. Set to FP.UseableMax in order to allow "unlimited" torque while respecting the FP usable range. Set UseMotor to enable or disable the hinge motor. More...
 
FP MotorSpeed
 The speed at which the hinge motor will attempt to rotate, in radians per second. Set UseMotor to enable or disable the hinge motor. More...
 
FP UpperLimitRad
 The upper angle of the allowed arc of rotation around the connected anchor, in radians. Set UseAngleLimits to enable or disable the angle-limiting constraints. More...
 

Static Public Attributes

const int SIZE = FPVector3.SIZE * 2 + EntityRef.SIZE + sizeof(int) * 2 + FP.SIZE * 4 + 2 * FPVector3RawInt.SIZE + FPQuaternionRawInt.SIZE
 The size of the struct in bytes. More...
 

Properties

FPVector3 Axis [get]
 Axis around which the joint rotates, defined in the local space of the entity. To modify the axis, use SetAxis. More...
 
FPQuaternion RelativeRotationReference [get, set]
 Reference rotation relative to the connected entity's space. More...
 
bool? UseAngleLimits [get, set]
 If the LowerLimitRad and UpperLimitRad limiting constraints should be considered and resolved by the Physics Engine. More...
 
bool? UseMotor [get, set]
 If the MotorSpeed and MaxMotorTorque constraints should be considered and resolved by the Physics Engine. More...
 

Detailed Description

A Joint3D that attaches a Physics Body to an anchor around which it can rotate. The connected anchor can be a world-space position or another entity with at least a transform component. The rotation can happen freely or, optionally, with limiting angles and/or a motor torque.

Constructor & Destructor Documentation

◆ HingeJoint3D()

Quantum.Physics3D.HingeJoint3D.HingeJoint3D ( FrameBase  f,
EntityRef  jointEntity,
FPVector3  axis,
NullableFP  lowerLimitRad,
NullableFP  upperLimitRad,
NullableFP  motorSpeed,
NullableFP  maxMotorTorque,
EntityRef  connectedEntity,
FPVector3  anchor,
FPVector3  connectedAnchor 
)
inline

Constructs a HingeJoint3D struct. Use CreateJoint instead to create a Joint3D of type JointType3D.HingeJoint.

Returns

Member Function Documentation

◆ CreateJoint()

static Joint3D Quantum.Physics3D.HingeJoint3D.CreateJoint ( FrameBase  f,
EntityRef  jointEntity,
FPVector3  axis,
NullableFP  lowerLimitRad,
NullableFP  upperLimitRad,
NullableFP  motorSpeed,
NullableFP  maxMotorTorque,
EntityRef  connectedEntity = default,
FPVector3  anchor = default,
FPVector3  connectedAnchor = default 
)
inlinestatic

Creates a Joint3D of type JointType3D.HingeJoint.

Parameters
f
jointEntity
axisAxis around which the joint rotates, defined in the local space of the entity. The vector is normalized before set. If zeroed, FPVector3.Right is used instead.
lowerLimitRadThe lower angle of the allowed arc of rotation around the connected anchor, in radians. If none is provided, i.e. default(NullableFP), and an upper limiting angle is set, the lower angle will be set to FP.UseableMin. If both limiting angles are null, UseAngleLimits is false and related constraints will not be applied.
upperLimitRadThe upper angle of the allowed arc of rotation around the connected anchor, in radians. If none is provided, i.e. default(NullableFP), and an lower limiting angle is set, the upper angle will be set to FP.UseableMax. If both limiting angles are null, UseAngleLimits is false and related constraints will not be applied.
motorSpeedThe speed at which the hinge motor will attempt to rotate, in radians per second. If none is provided, i.e. default(NullableFP), and a maximum motor toque is set, the target motor speed will be set to 0. If both motor speed and maximum torque are null, UseMotor is false and related constraints will not be applied.
maxMotorTorqueThe maximum torque produced by the hinge motor in order to achieve the target MotorSpeed. If none is provided, i.e. default(NullableFP), and a target motor speed is set, the maximum torque will be set to FP.UseableMax. If both motor speed and maximum torque are null, UseMotor is false and related constraints will not be applied.
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.HingeJoint.

◆ SetAxis()

void Quantum.Physics3D.HingeJoint3D.SetAxis ( FrameBase  f,
EntityRef  jointEntity,
FPVector3  axis,
bool  resetRelRotRef = false 
)
inline

Sets the Axis around which the joint rotates, defined in the local space of the entity.

Parameters
f
jointEntityEntity that contains this joint.
axisThe axis around which the joint rotates, defined in the local space of the entity. Normalized before being set. If zeroed, FPVector3.Right is used instead.
resetRelRotRefIf the joint's RelativeRotationReference should be reset. This field is usually only reset when the joint and connected entities are first connected.

◆ Serialize()

static void Quantum.Physics3D.HingeJoint3D.Serialize ( void *  ptr,
FrameSerializer  serializer 
)
inlinestatic

Serializes a HingeJoint3D into a FrameSerializer.

Parameters
ptrThe pointer to the HingeJoint3D.
serializerThe FrameSerializer instance into which the struct will be serialized.

◆ GetHashCode()

override int Quantum.Physics3D.HingeJoint3D.GetHashCode ( )
inline

Overrides the hash code generation of this type.

Returns
A hash code of the current state of this instance.

Member Data Documentation

◆ SIZE

const int Quantum.Physics3D.HingeJoint3D.SIZE = FPVector3.SIZE * 2 + EntityRef.SIZE + sizeof(int) * 2 + FP.SIZE * 4 + 2 * FPVector3RawInt.SIZE + FPQuaternionRawInt.SIZE
static

The size of the struct in bytes.

◆ Anchor

FPVector3 Quantum.Physics3D.HingeJoint3D.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.HingeJoint3D.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.HingeJoint3D.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.

◆ LowerLimitRad

FP Quantum.Physics3D.HingeJoint3D.LowerLimitRad

The lower angle of the allowed arc of rotation around the connected anchor, in radians. Set UseAngleLimits to enable or disable the angle-limiting constraints.

◆ UpperLimitRad

FP Quantum.Physics3D.HingeJoint3D.UpperLimitRad

The upper angle of the allowed arc of rotation around the connected anchor, in radians. Set UseAngleLimits to enable or disable the angle-limiting constraints.

◆ MotorSpeed

FP Quantum.Physics3D.HingeJoint3D.MotorSpeed

The speed at which the hinge motor will attempt to rotate, in radians per second. Set UseMotor to enable or disable the hinge motor.

◆ MaxMotorTorque

FP Quantum.Physics3D.HingeJoint3D.MaxMotorTorque

The maximum torque produced by the hinge motor in order to achieve the target MotorSpeed. Set to FP.UseableMax in order to allow "unlimited" torque while respecting the FP usable range. Set UseMotor to enable or disable the hinge motor.

Property Documentation

◆ UseAngleLimits

bool? Quantum.Physics3D.HingeJoint3D.UseAngleLimits
getset

If the LowerLimitRad and UpperLimitRad limiting constraints should be considered and resolved by the Physics Engine.

◆ UseMotor

bool? Quantum.Physics3D.HingeJoint3D.UseMotor
getset

If the MotorSpeed and MaxMotorTorque constraints should be considered and resolved by the Physics Engine.

◆ Axis

FPVector3 Quantum.Physics3D.HingeJoint3D.Axis
get

Axis around which the joint rotates, defined in the local space of the entity. To modify the axis, use SetAxis.

◆ RelativeRotationReference

FPQuaternion Quantum.Physics3D.HingeJoint3D.RelativeRotationReference
getset

Reference rotation relative to the connected entity's space.