pub struct RigidBody {
Show 17 fields pub collision: Option<[f32; 3]>, pub stepped: bool, pub air_drag: f32, pub fluid_drag: f32, pub resting: Vec3<i32>, pub in_fluid: bool, pub ratio_in_fluid: f32, pub velocity: Vec3<f32>, pub forces: Vec3<f32>, pub impulses: Vec3<f32>, pub sleep_frame_count: i32, pub aabb: AABB, pub mass: f32, pub friction: f32, pub restitution: f32, pub gravity_multiplier: f32, pub auto_step: bool,
}
Expand description

A physical body in the Voxelize world.

Fields

collision: Option<[f32; 3]>

If body.collision is true that tick, means there’s a collision detected.

stepped: bool

If the body stepped upwards that tick.

air_drag: f32

The amount of drag this body has in air.

fluid_drag: f32

The amount of drag this body has in fluid.

resting: Vec3<i32>

A vector representing which axis is the body resting against something.

in_fluid: bool

Whether or not this body is in fluid.

ratio_in_fluid: f32

Ratio of body this body is in fluid.

velocity: Vec3<f32>

Velocity vector of the rigid body.

forces: Vec3<f32>

Forces vector of the rigid body.

impulses: Vec3<f32>

Impulses vector of the rigid body.

sleep_frame_count: i32

Counts how many frames this rigid body is static.

aabb: AABB

AABB of this rigid body, describing its collision box.

mass: f32

Mass of this rigid body.

friction: f32

Friction of this rigid body.

restitution: f32

Restitution of this rigid body.

gravity_multiplier: f32

Gravity Multiplier of this rigid body. Set to 0 to fly.

auto_step: bool

Whether or not this rigid body auto-steps up blocks.

Implementations

Instantiate a new RigidBody using the Builder’s pattern.

Setter for rigid body’s position, which is the center of the rigid body.

Get the position of the rigid body, which is the bottom center of the rigid body.

Adds a vector to rigid body’s internal force, which gets processed every tick.

Adds a vector to rigid body’s internal impulse, which gets processed every tick.

Get x-axis of the resting vector of a rigid body. A resting vector indicates whether a body is resting or not.

Get y-axis of the resting vector of a rigid body. A resting vector indicates whether a body is resting or not.

Get z-axis of the resting vector of a rigid body. A resting vector indicates whether a body is resting or not.

Mark rigid body as active in the physical world.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. 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

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

Tries to create the default.

Calls try_default and panics on an error case.

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more