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... | |
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.
|
inline |
Constructs a HingeJoint struct. Use CreateJoint instead to create a 2D Joint of type JointType.HingeJoint.
|
inlinestatic |
Creates a 2D Physics2D.Joint of type JointType.HingeJoint.
lowerLimitRad | The 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. |
upperLimitRad | The 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. |
motorSpeed | The 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. |
maxMotorTorque | The 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. |
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. |
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 |
Serializes a HingeJoint into a FrameSerializer.
ptr | The pointer to the HingeJoint. |
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.
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.
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.
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.
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.
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.
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.
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.
|
getset |
If the LowerLimitRad and UpperLimitRad limiting constraints should be considered and resolved by the Physics Engine.
|
getset |
If the MotorSpeed and MaxMotorTorque constraints should be considered and resolved by the Physics Engine.