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

Joint component. 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.

There are many different kinds of joints. A Joint can represent all standard joint types except D6, which we have D6Joint for.

If you don’t set a second_entity, the joint will be to kind of a static invisible global frame - not super realistic, but often useful.

Usually accessed through entity.joint().

Most of the time, you’ll be better served by a D6Joint. Joint represent PhysX’s legacy joint types. They can be easier to use for simpler applications but D6Joint has all the capabilities and are more flexible.

Implementations

Returns a ValueAccessor for the joint type of the entity.

Used to set/get the mesh style.

The first entity of the joint.

The second entity of the joint.

The location on the first entity that the joint is attached to.

The location on the second entity that the joint is attached to.

The orientation of the joint on the second entity that the joint is attached to. For hinge joints, the default is the exact X axis, rotated by this orientation.

The orientation of the joint on the second entity that the joint is attached to. For hinge joints, the default is the exact X axis, rotated by this orientation.

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

  • Ball joint: x is the y angle limit of the cone (around the x axis), while y sets the z angle limit.
  • Hinge: x is the lower angle limit, y is the upper angle limit.
  • Slider: x is the lower position limit, y is the upper position limit.
  • Distance: x is the minimum distance, y is the maximum distance.

The limit type of a joint.

The joint velocity (angular for hinge joints, linear for linear joints). Can only be retrieved for now, need to use forces to change it.

Turns on joint drive. Currently only works with Hinge joints. D6Joint has more flexible drive capabilities, though.

The drive velocity. Does nothing unless drive_enable is set to true.

Sets the maximum force the joint drive can exercise.

Sets the gear ratio of the joint drive.

Enables freespin on the joint drive (it’ll continue to spin by inertia if you turn off the drive).

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.

Lets you check the angles or position of the joint. Interpreted differently depending on the joint type:

  • Hinge: x means the angle. You can use hinge_angle instead.
  • Ball: y means the y-angle, z means the z-angle. You can use ball_swing_angles instead.
  • Linear: x means the position along the joint. You can use linear_position instead.

Utility function for angle_or_position: If the joint is a hinge, returns the angle directly.

Utility function: If the joint is linear, returns the position along the line directly.

Utility function: If the joint is a ball joint, return the swing angles.

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.