pub struct PropBody {
pub prop_name: Option<AssetId>,
pub mass: f32,
pub friction: f32,
pub restitution: f32,
pub gravity_scale: f32,
pub linear_damping: f32,
pub impact_clip: Option<AudioClipHandle>,
pub impact_volume: f32,
}Expand description
Makes a companion Prop a dynamic physics body.
Attach a PropBody to give a Prop real physics: it falls, collides,
stacks, tumbles, and (with pickup: true on the prop) can be carried and
thrown. A Prop with a collider but no PropBody is a static, immovable
obstacle.
{
"name": "crate_a_body",
"type": "PropBody",
"args": { "prop_name": "crate_a", "mass": 4.0, "friction": 0.6 }
}Fields§
§prop_name: Option<AssetId>The Prop this body drives. Must match a Prop declared in the same world.
mass: f32Mass in kilograms. 0 lets the simulation derive mass from the collider shape and a default density.
friction: f32Friction coefficient used for contacts with this body.
restitution: f32Bounciness in [0, 1]. 0 is fully inelastic.
gravity_scale: f32Multiplier applied to world gravity for this body. 1.0 is normal.
linear_damping: f32Linear velocity damping, modelling air drag.
impact_clip: Option<AudioClipHandle>Optional AudioClip played at the contact point when this
body collides hard enough to pass the world’s contact_min_impulse
(see PhysicsConfig). Louder impacts play louder.
impact_volume: f32Linear gain applied to the impact clip at full impulse.
Trait Implementations§
Source§impl Component for PropBody
impl Component for PropBody
Source§fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>
fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>
Source§fn inject_locator(&mut self, _locator: PayloadLocator)
fn inject_locator(&mut self, _locator: PayloadLocator)
Source§fn inject_name(&mut self, _id: AssetId)
fn inject_name(&mut self, _id: AssetId)
Source§impl ComponentSlot for PropBody
impl ComponentSlot for PropBody
Source§const DISCRIMINANT: u8
const DISCRIMINANT: u8
ComponentId.