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
impl PhysicsBody
pub fn type_(&self) -> PhysicsBodyType
pub fn set_type_(&mut self, value: PhysicsBodyType)
pub fn bone_index(&self) -> u16
pub fn set_bone_index(&mut self, value: u16)
Sourcepub fn position(&self) -> Vector3f
pub fn position(&self) -> Vector3f
Offset from the bone’s animated position, not an absolute position: the client spawns the body at bonePosition + position.
pub fn set_position(&mut self, value: Vector3f)
Sourcepub fn shape_index(&self) -> i32
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.
pub fn set_shape_index(&mut self, value: i32)
pub fn shape_count(&self) -> i32
pub fn set_shape_count(&mut self, value: i32)
Sourcepub fn gravity_scale(&self) -> f32
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.
pub fn set_gravity_scale(&mut self, value: f32)
Sourcepub fn inertia_scale(&self) -> f32
pub fn inertia_scale(&self) -> f32
BDY2+. 1.0 in 3457 of 3526 bodies, otherwise 1.1-10 — dmBodyDef::m_inertiaScale.
pub fn set_inertia_scale(&mut self, value: f32)
Sourcepub fn linear_damping(&self) -> f32
pub fn linear_damping(&self) -> f32
BDY3+. Zero on 1196 of 1213 kinematic bodies and 0-10 on dynamic ones — dmBodyDef::m_linearDamping.
pub fn set_linear_damping(&mut self, value: f32)
Sourcepub fn angular_damping(&self) -> f32
pub fn angular_damping(&self) -> f32
BDY3+. Same kinematic/dynamic split as @ref linearDamping — dmBodyDef::m_angularDamping.
pub fn set_angular_damping(&mut self, value: f32)
Sourcepub fn unknown_28(&self) -> f32
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.
pub fn set_unknown_28(&mut self, value: f32)
Sourcepub fn unknown_2c(&self) -> u16
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.
pub fn set_unknown_2c(&mut self, value: u16)
Sourcepub fn padding_2e(&self) -> u16
pub fn padding_2e(&self) -> u16
BDY4+. Zero in every corpus body.