A Joint that connects a Physics Body to an anchor and attempts 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 | |
DistanceJoint (FP minDistance, FP maxDistance, EntityRef connectedEntity, FPVector2 anchor, FPVector2 connectedAnchor) | |
Constructs a DistanceJoint struct. Use CreateJoint instead to create a 2D Joint of type JointType.DistanceJoint. More... | |
override int | GetHashCode () |
Overrides the hash code generation of this type. More... | |
Static Public Member Functions | |
static Joint | CreateJoint (FP minDistance, FP maxDistance, EntityRef connectedEntity=default, FPVector2 anchor=default, FPVector2 connectedAnchor=default) |
Creates a 2D Physics2D.Joint of type JointType.DistanceJoint. More... | |
static void | Serialize (void *ptr, FrameSerializer serializer) |
Serializes a DistanceJoint 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... | |
Static Public Attributes | |
const int | SIZE = FPVector2.SIZE * 2 + EntityRef.SIZE + FP.SIZE * 2 |
The size of the struct in bytes. More... | |
Properties | |
FP | MaxDistance [get, set] |
The maximum distance between the anchor points that the joint will attempt to maintain. If set to FP.UseableMax, allows any distance in the usable range above MinDistance. More... | |
FP | MinDistance [get, set] |
The minimum distance between the anchor points that the joint will attempt to maintain. If set to zero or default, allows any distance below MaxDistance. More... | |
A Joint that connects a Physics Body to an anchor and attempts 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 DistanceJoint struct. Use CreateJoint instead to create a 2D Joint of type JointType.DistanceJoint.
|
inlinestatic |
Creates a 2D Physics2D.Joint of type JointType.DistanceJoint.
minDistance | The minimum distance between the anchor points that the joint will attempt to maintain. If set to zero or default, allows any distance below MaxDistance. |
maxDistance | The maximum distance between the anchor points that the joint will attempt to maintain. If set to FP.UseableMax, allows any distance in the usable range above MinDistance. |
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 DistanceJoint into a FrameSerializer.
ptr | The pointer to the DistanceJoint. |
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.DistanceJoint.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.DistanceJoint.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.DistanceJoint.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.
|
getset |
The minimum distance between the anchor points that the joint will attempt to maintain. If set to zero or default, allows any distance below MaxDistance.
|
getset |
The maximum distance between the anchor points that the joint will attempt to maintain. If set to FP.UseableMax, allows any distance in the usable range above MinDistance.