Struct liquidfun::box2d::dynamics::body::BodyDef
[−]
[src]
pub struct BodyDef { pub body_type: BodyType, pub position: Vec2, pub angle: Float32, pub linear_velocity: Vec2, pub angular_velocity: Float32, pub linear_damping: Float32, pub angular_damping: Float32, pub allow_sleep: bool, pub awake: bool, pub fixed_rotation: bool, pub bullet: bool, pub active: bool, pub user_data: size_t, pub gravity_scale: Float32, }
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
body_type | The body type: static, kinematic, or dynamic. Note: if a dynamic body would have zero mass, the mass is set to one. |
position | The world position of the body. Avoid creating bodies at the origin since this can lead to many overlapping shapes. |
angle | The world angle of the body in radians. |
linear_velocity | The linear velocity of the body's origin in world co-ordinates. |
angular_velocity | The angular velocity of the body. |
linear_damping | Linear 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. |
angular_damping | Angular 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. |
allow_sleep | Set this flag to false if this body should never fall asleep. Note that this increases CPU usage. |
awake | Is this body initially awake or sleeping? |
fixed_rotation | Should this body be prevented from rotating? Useful for characters. |
bullet | Is 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. |
active | Does this body start out active? |
user_data | Use this to store application specific body data. |
gravity_scale | Scale the gravity applied to this body. |