Class Joint
A base class for all Joint types. Joints constrain how two rigidbodies move relative to one another (for example a door hinge). One of the bodies in the joint must always be movable (non-kinematic and non-static).
Inheritance
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public abstract class Joint : Actor, ISerializable
Remarks
Joint constraint is created between the parent physic actor (rigidbody, character controller, etc.) and the specified target actor.
Constructors
Joint()
Properties
BreakForce
Gets or sets the break force. Determines the maximum force the joint can apply before breaking. Broken joints no longer participate in physics simulation.
Declaration
[EditorOrder(10)]
[EditorDisplay("Joint", null)]
[ValueCategory]
[Unmanaged]
public float BreakForce { get; set; }
Property Value
|
System.Single
|
BreakTorque
Gets or sets the break torque. Determines the maximum torque the joint can apply before breaking. Broken joints no longer participate in physics simulation.
Declaration
[EditorOrder(20)]
[EditorDisplay("Joint", null)]
[ValueCategory]
[Unmanaged]
public float BreakTorque { get; set; }
Property Value
|
System.Single
|
EnableAutoAnchor
Determines whether use automatic target anchor position and rotation based on the joint world-space frame (computed when creating joint).
Declaration
[EditorOrder(39)]
[EditorDisplay("Joint", null)]
[Unmanaged]
public bool EnableAutoAnchor { get; set; }
Property Value
|
System.Boolean
|
EnableCollision
Determines whether collision between the two bodies managed by the joint are enabled.
Declaration
[EditorOrder(30)]
[EditorDisplay("Joint", null)]
[Unmanaged]
public bool EnableCollision { get; set; }
Property Value
|
System.Boolean
|
Target
The target actor for the joint. It has to be IPhysicsActor type (eg. RigidBody or CharacterController).
Declaration
[EditorOrder(0)]
[EditorDisplay("Joint", null)]
[Unmanaged]
public Actor Target { get; set; }
Property Value
|
Actor
|
TargetAnchor
Gets or sets the target anchor.
Declaration
[EditorOrder(40)]
[EditorDisplay("Joint", null)]
[VisibleIf("EnableAutoAnchor", true)]
[Unmanaged]
public Vector3 TargetAnchor { get; set; }
Property Value
|
Vector3
|
Remarks
This is the relative pose which locates the joint frame relative to the target actor.
TargetAnchorRotation
Gets or sets the target anchor rotation.
Declaration
[EditorOrder(50)]
[EditorDisplay("Joint", null)]
[VisibleIf("EnableAutoAnchor", true)]
[Unmanaged]
public Quaternion TargetAnchorRotation { get; set; }
Property Value
|
Quaternion
|
Remarks
This is the relative pose rotation which locates the joint frame relative to the target actor.
Methods
GetCurrentForce(out Vector3, out Vector3)
Gets the current force applied by the solver to maintain all constraints.
Declaration
[Unmanaged]
public void GetCurrentForce(out Vector3 linear, out Vector3 angular)
Parameters
|
Vector3
linear
The result linear force. |
|
Vector3
angular
The result angular force. |
SetJointLocation(Vector3)
Sets the location of the joint by automatically computing local position and target anchor to place a joint at the given location (world-space).
Declaration
[Unmanaged]
public void SetJointLocation(Vector3 location)
Parameters
|
Vector3
location
The joint location to set (world-space). |
Remarks
Use this utility to automatically place joint at the given location after setting up joint parent and target.
SetJointOrientation(Quaternion)
Sets the orientation of the joint by automatically computing local orientation and target anchor orientation to orient a joint at the given rotation (world-space).
Declaration
[Unmanaged]
public void SetJointOrientation(Quaternion orientation)
Parameters
|
Quaternion
orientation
The joint orientation to set (world-space). |
Remarks
Use this utility to automatically rotate joint at the given location after setting up joint parent and target.
Events
JointBreak
Occurs when a joint gets broken during simulation.
Declaration
[Unmanaged]
public event Action JointBreak
Event Type
|
System.Action
|