Struct libliquidfun_sys::box2d::ffi::b2BodyDef
source · #[repr(C)]pub struct b2BodyDef {Show 14 fields
pub type_: b2BodyType,
pub position: b2Vec2,
pub angle: f32,
pub linearVelocity: b2Vec2,
pub angularVelocity: f32,
pub linearDamping: f32,
pub angularDamping: f32,
pub allowSleep: bool,
pub awake: bool,
pub fixedRotation: bool,
pub bullet: bool,
pub enabled: bool,
pub userData: b2BodyUserData,
pub gravityScale: f32,
}Expand description
A body definition holds all the data needed to construct a rigid body. You can safely re-use body definitions. Shapes are added to a body after construction.
Fields§
§type_: b2BodyTypeThe body type: static, kinematic, or dynamic. Note: if a dynamic body would have zero mass, the mass is set to one.
position: b2Vec2The world position of the body. Avoid creating bodies at the origin since this can lead to many overlapping shapes.
angle: f32The world angle of the body in radians.
linearVelocity: b2Vec2The linear velocity of the body’s origin in world co-ordinates.
angularVelocity: f32The angular velocity of the body.
linearDamping: f32Linear damping is use to reduce the linear velocity. The damping parameter can be larger than 1.0f but the damping effect becomes sensitive to the time step when the damping parameter is large. Units are 1/time
angularDamping: f32Angular damping is use to reduce the angular velocity. The damping parameter can be larger than 1.0f but the damping effect becomes sensitive to the time step when the damping parameter is large. Units are 1/time
allowSleep: boolSet this flag to false if this body should never fall asleep. Note that this increases CPU usage.
awake: boolIs this body initially awake or sleeping?
fixedRotation: boolShould this body be prevented from rotating? Useful for characters.
bullet: boolIs this a fast moving body that should be prevented from tunneling through other moving bodies? Note that all bodies are prevented from tunneling through kinematic and static bodies. This setting is only considered on dynamic bodies. @warning You should use this flag sparingly since it increases processing time.
enabled: boolDoes this body start out enabled?
userData: b2BodyUserDataUse this to store application specific body data.
gravityScale: f32Scale the gravity applied to this body.