Skip to main content

PhysicsBody

Struct PhysicsBody 

Source
pub struct PhysicsBody { /* private fields */ }
Expand description

One rigid body, bound to a single model bone — BODY/BDY2/BDY3/BDY4.

The four on-disk layouts are the same fields accreting over time, so they share one struct; PhysicsData::version decides which of them is written back, and fields the older layouts lack keep their defaults.

Implementations§

Source§

impl PhysicsBody

Source

pub fn new() -> Self

§Panics

Panics if the native allocation fails.

Source

pub fn type_(&self) -> PhysicsBodyType

Source

pub fn set_type_(&mut self, value: PhysicsBodyType)

Source

pub fn bone_index(&self) -> u16

Source

pub fn set_bone_index(&mut self, value: u16)

Source

pub fn position(&self) -> Vector3f

Offset from the bone’s animated position, not an absolute position: the client spawns the body at bonePosition + position.

Source

pub fn set_position(&mut self, value: Vector3f)

Source

pub fn shape_index(&self) -> i32

First entry in PhysicsData::shapes belonging to this body. 32 bits wide in BODY/BDY2, 16 from BDY3 on — writing a larger index back into one of those truncates it.

Source

pub fn set_shape_index(&mut self, value: i32)

Source

pub fn shape_count(&self) -> i32

Source

pub fn set_shape_count(&mut self, value: i32)

Source

pub fn gravity_scale(&self) -> f32

BDY3+. 1.0 on all but 45 of 1213 kinematic bodies but tuned freely on dynamic ones, negatives included — the shape of dmBodyDef::m_gravityScale.

Source

pub fn set_gravity_scale(&mut self, value: f32)

Source

pub fn inertia_scale(&self) -> f32

BDY2+. 1.0 in 3457 of 3526 bodies, otherwise 1.1-10 — dmBodyDef::m_inertiaScale.

Source

pub fn set_inertia_scale(&mut self, value: f32)

Source

pub fn linear_damping(&self) -> f32

BDY3+. Zero on 1196 of 1213 kinematic bodies and 0-10 on dynamic ones — dmBodyDef::m_linearDamping.

Source

pub fn set_linear_damping(&mut self, value: f32)

Source

pub fn angular_damping(&self) -> f32

BDY3+. Same kinematic/dynamic split as @ref linearDamping — dmBodyDef::m_angularDamping.

Source

pub fn set_angular_damping(&mut self, value: f32)

Source

pub fn unknown_28(&self) -> f32

BDY3+. Unidentified. Unlike the four above it is set on kinematic and dynamic bodies alike, so it is not a rigid-body integration parameter; values cluster on 0.5, 0.01, 0.9 and 0.1.

Source

pub fn set_unknown_28(&mut self, value: f32)

Source

pub fn unknown_2c(&self) -> u16

BDY4+. Unidentified; 0 in half the corpus, otherwise small values or 0x8000 alone, which reads like a bit field.

Source

pub fn set_unknown_2c(&mut self, value: u16)

Source

pub fn padding_2e(&self) -> u16

BDY4+. Zero in every corpus body.

Source

pub fn set_padding_2e(&mut self, value: u16)

Trait Implementations§

Source§

impl Debug for PhysicsBody

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for PhysicsBody

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Drop for PhysicsBody

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for PhysicsBody

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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 T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.