logo
pub struct D6Joint { /* private fields */ }
Expand description

D6Joint component. A D6 joint, like a Joint, connects two dynamic, or one static and one dynamic, entity physically. It doesn’t have to be a component of one of the entities it connects, but that can be convenient at times.

The D6Joint has 6 degrees of freedom (hence the name): 3 translational, and 3 rotational. These can all be controlled individually.

Important: By default all six dimensions of motion are locked, so by default a D6Joint acts like a fix-joint, gluing the bodies to each other. To do something else you need to unlock the dimensions with the motion accessor. For instance, so create a ball-socket joint you would unlock the rotational degrees of movement but keep the translational degrees locked.

A joint normally connects two entities, but you can also leave one of the entities to the default None value too attach an entity to the world frame, a static infinite-mass invisible global frame.

Usually accessed through entity.d6_joint().

The NVIDIA PhysX documentation has some more details. Some naming is a little different from the official API, but overall the concepts are the same.

Implementations

The first entity of the joint.

The second entity of the joint.

The position of the joint relative to the first entity (entity_1)

The orientation of the joint relative to the first entity (entity_1)

The position of the joint relative to the second entity (entity_2)

The orientation of the joint relative to the second entity (entity_2)

Sets the force threshold for breaking the joint. Default is std::f32::MAX (effectively unbreakable).

Sets the torque threshold for breaking the joint. Default is std::f32::MAX (effectively unbreakable).

Lets you check whether the joint is broken. Cannot be modified.

If non-zero, linear projection is enabled (a way of resolving tricky physics situations by moving the parts into place), and the linear projection tolerance is set to this value.

Projection is a on-physical process that violates conservation laws and collision meshes. Only turn it on if you absolutely need to.

If non-zero, projection is enabled (a way of resolving tricky physics situations by turning the parts into place), and the angular projection tolerance is set to this value.

Projection is a on-physical process that violates conservation laws and collision meshes. Only turn it on if you absolutely need to.

Turns on joint drive. Note that this disables the use of limits on the joint.

Get the raw translation between the two parts of the joint.

Get the raw rotation between the two parts of the joint. Not decomposed into TSS (twist, swing1, swing2).

Gets the rotation decomposed into TSS (twist, swing1, swing2).

The limit bounds of a D6 joint. x is min, y is max, what exactly it limits depends on the joint type.

The linear limit type of a D6 joint.

The linear limit spring of a D6 joint.

The twist limit bounds of a D6 joint.

The linear limit type of a D6 joint.

The linear limit spring of a D6 joint.

The swing limit bounds of a D6 joint (angular)

The linear limit type of a D6 joint.

The swing limit spring of a D6 joint.

Goal position of the D6 drive.

Goal rotation of the D6 drive.

Goal linear velocity of the D6 drive.

Goal angular velocity of the D6 drive.

Set the motion type of each of the D6 joint’s six axes, D6Axis. Can be locked, limited or free.

By default, all six axis are locked, so you need to unlock any axis you would like enable movement of.

Hinge

Free movement aroudn the X axis:

joint.motion(D6Axis::Twist).set(D6MotionType::Free);
Ball-socket joint
joint.motion(D6Axis::Twist).set(D6MotionType::Free);
joint.motion(D6Axis::Swing1).set(D6MotionType::Free);
joint.motion(D6Axis::Swing2).set(D6MotionType::Free);

Lets you control the six possible drives from D6Drive by setting a D6DriveParams.

Controls whether drive is a force (false) or acceleration (true). Acceleration is much easier to tune since it will automatically compute the appropriate force for the masses involved, so it’s the default and recommended value.

Returns the linear force currently exerted on the joint constraint.

Returns the angular force currently exerted on the joint constraint.

Trait Implementations

The type of the component, as a ComponentType enum.

Adopt an Entity, wrap in a component struct.

Get the entity that the component belongs to.

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.