Struct ark_api::world::D6Joint

source ·
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§

source§

impl D6Joint

source

pub fn entity_1(&self) -> ValueAccessorReadWrite<Entity>

The first entity of the joint.

source

pub fn entity_2(&self) -> ValueAccessorReadWrite<Entity>

The second entity of the joint.

source

pub fn relative_offset_1(&self) -> ValueAccessorReadWrite<Vec3>

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

source

pub fn relative_orientation_1(&self) -> ValueAccessorReadWrite<Quat>

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

source

pub fn relative_offset_2(&self) -> ValueAccessorReadWrite<Vec3>

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

source

pub fn relative_orientation_2(&self) -> ValueAccessorReadWrite<Quat>

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

source

pub fn break_force(&self) -> ValueAccessorReadWrite<f32>

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

source

pub fn break_torque(&self) -> ValueAccessorReadWrite<f32>

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

source

pub fn is_broken(&self) -> ValueAccessorRead<bool>

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

source

pub fn projection_linear_tolerance(&self) -> ValueAccessorReadWriteAnimate<f32>

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.

source

pub fn projection_angular_tolerance(&self) -> ValueAccessorReadWriteAnimate<f32>

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.

source

pub fn drive_enable(&self) -> ValueAccessorReadWriteAnimate<bool>

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

source

pub fn relative_position(&self) -> ValueAccessorRead<Vec3>

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

source

pub fn relative_rotation(&self) -> ValueAccessorRead<Quat>

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

source

pub fn relative_angles(&self) -> ValueAccessorRead<Vec3>

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

source

pub fn linear_limit(&self) -> ValueAccessorReadWrite<f32>

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

source

pub fn linear_limit_type(&self) -> ValueAccessorReadWrite<JointLimitType>

The linear limit type of a D6 joint.

source

pub fn linear_limit_spring(&self) -> ValueAccessorReadWrite<D6SpringParams>

The linear limit spring of a D6 joint.

source

pub fn twist_limit(&self) -> ValueAccessorReadWrite<Vec2>

The twist limit bounds of a D6 joint.

source

pub fn twist_limit_type(&self) -> ValueAccessorReadWrite<JointLimitType>

The linear limit type of a D6 joint.

source

pub fn twist_limit_spring(&self) -> ValueAccessorReadWrite<D6SpringParams>

The linear limit spring of a D6 joint.

source

pub fn swing_limit(&self) -> ValueAccessorReadWrite<Vec2>

The swing limit bounds of a D6 joint (angular)

source

pub fn swing_limit_type(&self) -> ValueAccessorReadWrite<JointLimitType>

The linear limit type of a D6 joint.

source

pub fn swing_limit_spring(&self) -> ValueAccessorReadWrite<D6SpringParams>

The swing limit spring of a D6 joint.

source

pub fn drive_position(&self) -> ValueAccessorReadWrite<Vec3>

Goal position of the D6 drive.

source

pub fn drive_rotation(&self) -> ValueAccessorReadWrite<Quat>

Goal rotation of the D6 drive.

source

pub fn drive_linear_velocity(&self) -> ValueAccessorReadWrite<Vec3>

Goal linear velocity of the D6 drive.

source

pub fn drive_angular_velocity(&self) -> ValueAccessorReadWrite<Vec3>

Goal angular velocity of the D6 drive.

source

pub fn motion(&self, index: D6Axis) -> ValueAccessorReadWrite<D6MotionType>

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);
source

pub fn drive_params( &self, index: D6Drive ) -> ValueAccessorReadWrite<D6DriveParams>

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

source

pub fn drive_is_acceleration(&self) -> ValueAccessorReadWrite<bool>

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.

source

pub fn linear_force(&self) -> ValueAccessorRead<Vec3>

Returns the linear force currently exerted on the joint constraint.

source

pub fn angular_force(&self) -> ValueAccessorRead<Vec3>

Returns the angular force currently exerted on the joint constraint.

Trait Implementations§

source§

impl ComponentTrait for D6Joint

source§

fn get_type() -> ComponentType

The type of the component, as a ComponentType enum.
source§

fn from_entity(handle: Entity) -> Self

Adopt an Entity, wrap in a component struct.
source§

fn entity(&self) -> Entity

Get the entity that the component belongs to.
source§

impl Debug for D6Joint

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.