Photon Quantum 3.0.0

Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
Quantum.Physics2D.HingeJoint Struct Reference

A Joint 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

 HingeJoint (NullableFP lowerLimitRad, NullableFP upperLimitRad, NullableFP motorSpeed, NullableFP maxMotorTorque, EntityRef connectedEntity, FPVector2 anchor, FPVector2 connectedAnchor)
 Constructs a HingeJoint struct. Use CreateJoint instead to create a 2D Joint of type JointType.HingeJoint. More...
 
override int GetHashCode ()
 Overrides the hash code generation of this type. More...
 

Static Public Member Functions

static Joint CreateJoint (NullableFP lowerLimitRad, NullableFP upperLimitRad, NullableFP motorSpeed, NullableFP maxMotorTorque, EntityRef connectedEntity=default, FPVector2 anchor=default, FPVector2 connectedAnchor=default)
 Creates a 2D Physics2D.Joint of type JointType.HingeJoint. More...
 
static void Serialize (void *ptr, FrameSerializer serializer)
 Serializes a HingeJoint into a FrameSerializer. More...
 

Public Attributes

FPVector2 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...
 
FPVector2 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 Transform2D component. If it also has a non-kinematic PhysicsBody2D, 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 = FPVector2.SIZE * 2 + EntityRef.SIZE + sizeof(int) * 2 + FP.SIZE * 4
 The size of the struct in bytes. More...
 

Properties

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

◆ HingeJoint()

Quantum.Physics2D.HingeJoint.HingeJoint ( NullableFP  lowerLimitRad,
NullableFP  upperLimitRad,
NullableFP  motorSpeed,
NullableFP  maxMotorTorque,
EntityRef  connectedEntity,
FPVector2  anchor,
FPVector2  connectedAnchor 
)
inline

Constructs a HingeJoint struct. Use CreateJoint instead to create a 2D Joint of type JointType.HingeJoint.

Returns

Member Function Documentation

◆ CreateJoint()

static Joint Quantum.Physics2D.HingeJoint.CreateJoint ( NullableFP  lowerLimitRad,
NullableFP  upperLimitRad,
NullableFP  motorSpeed,
NullableFP  maxMotorTorque,
EntityRef  connectedEntity = default,
FPVector2  anchor = default,
FPVector2  connectedAnchor = default 
)
inlinestatic

Creates a 2D Physics2D.Joint of type JointType.HingeJoint.

Parameters
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 Transform2D component. If it also has a non-kinematic PhysicsBody2D, 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 Joint of type JointType.HingeJoint.

◆ Serialize()

static void Quantum.Physics2D.HingeJoint.Serialize ( void *  ptr,
FrameSerializer  serializer 
)
inlinestatic

Serializes a HingeJoint into a FrameSerializer.

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

◆ GetHashCode()

override int Quantum.Physics2D.HingeJoint.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.Physics2D.HingeJoint.SIZE = FPVector2.SIZE * 2 + EntityRef.SIZE + sizeof(int) * 2 + FP.SIZE * 4
static

The size of the struct in bytes.

◆ Anchor

FPVector2 Quantum.Physics2D.HingeJoint.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

FPVector2 Quantum.Physics2D.HingeJoint.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.Physics2D.HingeJoint.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 Transform2D component. If it also has a non-kinematic PhysicsBody2D, joint forces are also computed and applied to it.

◆ LowerLimitRad

FP Quantum.Physics2D.HingeJoint.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.Physics2D.HingeJoint.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.Physics2D.HingeJoint.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.Physics2D.HingeJoint.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.Physics2D.HingeJoint.UseAngleLimits
getset

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

◆ UseMotor

bool? Quantum.Physics2D.HingeJoint.UseMotor
getset

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