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).
Joint constraint is created between the parent physic actor (rigidbody, character controller, etc.) and the specified target actor.
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Physics/Joints/Joint.h
Syntax
public class Joint : public Actor
Fields
_breakForce
Declaration
protected float _breakForce
Field Value
float
|
_breakTorque
Declaration
protected float _breakTorque
Field Value
float
|
_enableAutoAnchor
Declaration
protected bool _enableAutoAnchor = false
Field Value
bool
|
_enableCollision
Declaration
protected bool _enableCollision = true
Field Value
bool
|
_joint
Declaration
protected void* _joint
Field Value
void
|
_targetAnchor
Declaration
protected Vector3 _targetAnchor
Field Value
Vector3
|
_targetAnchorRotation
JointBreak
Occurs when a joint gets broken during simulation.
Declaration
public Action JointBreak
Field Value
Action
|
Target
The target actor for the joint. It has to be IPhysicsActor type (eg. RigidBody or CharacterController).
Declaration
public ScriptingObjectReference<Actor> Target
Field Value
ScriptingObjectReference<Actor>
|
Methods
BeginPlay(SceneBeginData* data)
Called when adding object to the game.
Declaration
protected virtual void BeginPlay(SceneBeginData* data) override
Parameters
SceneBeginData
data
The initialization data (e.g. used to collect joints to link after begin). |
Overrides
Create()
Creates native join object.
Declaration
public void Create()
CreateJoint(const struct PhysicsJointDesc& desc)
Declaration
protected virtual void* CreateJoint(const struct PhysicsJointDesc& desc) = 0
Parameters
struct PhysicsJointDesc
desc
|
Returns
void
|
Deserialize(DeserializeStream& stream, ISerializeModifier* modifier)
Deserializes object from the input stream.
Declaration
public virtual void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override
Parameters
DeserializeStream
stream
The input stream. |
ISerializeModifier
modifier
The deserialization modifier object. Always valid. |
Overrides
DrawPhysicsDebug(RenderView& view)
EndPlay()
Called when removing object from the game.
Declaration
protected virtual void EndPlay() override
Overrides
GetBreakForce()
Gets the break force. Determines the maximum force the joint can apply before breaking. Broken joints no longer participate in physics simulation.
Declaration
public float GetBreakForce() const
Returns
float
|
GetBreakTorque()
Gets the break torque. Determines the maximum torque the joint can apply before breaking. Broken joints no longer participate in physics simulation.
Declaration
public float GetBreakTorque() const
Returns
float
|
GetCurrentForce(Vector3& linear, Vector3& angular)
Gets the current force applied by the solver to maintain all constraints.
Declaration
public void GetCurrentForce(Vector3& linear, Vector3& angular) const
Parameters
Vector3
linear
The result linear force. |
Vector3
angular
The result angular force. |
GetEnableAutoAnchor()
Determines whether use automatic target anchor position and rotation based on the joint world-space frame (computed when creating joint).
Declaration
public bool GetEnableAutoAnchor() const
Returns
bool
|
GetEnableCollision()
Determines whether collision between the two bodies managed by the joint are enabled.
Declaration
public bool GetEnableCollision() const
Returns
bool
|
GetPhysicsImpl()
Gets the native physics backend object.
Declaration
public void* GetPhysicsImpl() const
Returns
void
|
GetTargetAnchor()
Gets the target anchor.
This is the relative pose which locates the joint frame relative to the target actor.
Declaration
public Vector3 GetTargetAnchor() const
Returns
Vector3
|
GetTargetAnchorRotation()
Gets the target anchor rotation.
This is the relative pose rotation which locates the joint frame relative to the target actor.
Declaration
public Quaternion GetTargetAnchorRotation() const
Returns
Quaternion
|
GetTargetOrientation()
GetTargetPosition()
Declaration
protected Vector3 GetTargetPosition() const
Returns
Vector3
|
OnActiveInTreeChanged()
Called when actor active in tree state gets changed.
Declaration
protected virtual void OnActiveInTreeChanged() override
Overrides
OnDebugDrawSelected()
Draws debug shapes for the selected actor and all child scripts.
Declaration
public virtual void OnDebugDrawSelected() override
Overrides
OnDisable()
Called when actor gets removed from game systems. Occurs on EndPlay event or when actor gets inactivated in hierarchy. Use this event to unregister object from other game system (eg. audio).
Declaration
protected virtual void OnDisable() override
Overrides
OnEnable()
Called when actor gets added to game systems. Occurs on BeginPlay event or when actor gets activated in hierarchy. Use this event to register object to other game system (eg. audio).
Declaration
protected virtual void OnEnable() override
Overrides
OnJointBreak()
Called by the physics system when joint gets broken.
Declaration
public virtual void OnJointBreak()
OnParentChanged()
Called when actor parent gets changed.
Declaration
protected virtual void OnParentChanged() override
Overrides
OnTransformChanged()
Called when actor transform gets changed.
Declaration
protected virtual void OnTransformChanged() override
Overrides
Serialize(SerializeStream& stream, const void* otherObj)
Serializes object to the output stream compared to the values of the other object instance (eg. default class object). If other object is null then serialize all properties.
Declaration
public virtual void Serialize(SerializeStream& stream, const void* otherObj) override
Parameters
SerializeStream
stream
The output stream. |
void
otherObj
The instance of the object to compare with and serialize only the modified properties. If null, then serialize all properties. |
Overrides
SetBreakForce(float value)
Sets the break force. Determines the maximum force the joint can apply before breaking. Broken joints no longer participate in physics simulation.
Declaration
public void SetBreakForce(float value)
Parameters
float
value
|
SetBreakTorque(float value)
Sets the break torque. Determines the maximum torque the joint can apply before breaking. Broken joints no longer participate in physics simulation.
Declaration
public void SetBreakTorque(float value)
Parameters
float
value
|
SetEnableAutoAnchor(bool value)
Determines whether use automatic target anchor position and rotation based on the joint world-space frame (computed when creating joint).
Declaration
public void SetEnableAutoAnchor(bool value)
Parameters
bool
value
|
SetEnableCollision(bool value)
Determines whether collision between the two bodies managed by the joint are enabled.
Declaration
public void SetEnableCollision(bool value)
Parameters
bool
value
|
SetJointLocation(const Vector3& location)
Sets the location of the joint by automatically computing local position and target anchor to place a joint at the given location (world-space).
Use this utility to automatically place joint at the given location after setting up joint parent and target.
Declaration
public void SetJointLocation(const Vector3& location)
Parameters
Vector3
location
The joint location to set (world-space). |
SetJointOrientation(const Quaternion& orientation)
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).
Use this utility to automatically rotate joint at the given location after setting up joint parent and target.
Declaration
public void SetJointOrientation(const Quaternion& orientation)
Parameters
Quaternion
orientation
The joint orientation to set (world-space). |
SetTargetAnchor(const Vector3& value)
Sets the target anchor.
This is the relative pose which locates the joint frame relative to the target actor.
Declaration
public void SetTargetAnchor(const Vector3& value)
Parameters
Vector3
value
|
SetTargetAnchorRotation(const Quaternion& value)
Sets the target anchor rotation.
This is the relative pose rotation which locates the joint frame relative to the target actor.
Declaration
public void SetTargetAnchorRotation(const Quaternion& value)
Parameters
Quaternion
value
|