Skip to main content

Module body

Module body 

Source

Modules§

body_flags

Structs§

Body
Body organizational details that are not used in the solver. (b2Body)
BodySim
Body simulation data used for integration of position and velocity. Transform data used for collision and solver preparation. (b2BodySim)
BodyState
Body state, designed for fast conversion to and from SIMD via scatter-gather. Only awake dynamic and kinematic bodies have a body state. Used in the performance critical constraint solver. (b2BodyState, 32 bytes)

Constants§

IDENTITY_BODY_STATE
Identity body state, notice the delta_rotation is {1, 0}. (b2_identityBodyState)

Functions§

body_sim_location
Location of a body’s sim data: (set_index, local_index). Use to borrow the BodySim through world.solver_sets. (b2GetBodySim resolves to a pointer in C; the index pair is the borrow-safe equivalent.)
create_body
Create a rigid body given a definition. (b2CreateBody)
destroy_body
Destroy a rigid body and everything attached to it: joints, contacts, shapes, and chains. (b2DestroyBody)
get_body_full_id
Get a validated body index from an id. (b2GetBodyFullId — C returns a pointer; Rust returns the raw index into world.bodies)
get_body_sim
Borrow a body’s sim data mutably. (b2GetBodySim)
get_body_state
Borrow a body’s state if it is in the awake set. (b2GetBodyState)
get_body_transform
(b2GetBodyTransform)
get_body_transform_quick
(b2GetBodyTransformQuick)
make_body_id
Create a BodyId from a raw id. (b2MakeBodyId)
make_relative_sweep
Build a sweep relative to a base position so continuous collision keeps float precision far from the origin. The base cancels out of the relative motion the TOI actually solves. (b2MakeRelativeSweep)
remove_body_sim
Remove a body sim from a set with swap-removal, fixing the moved body’s local index. (b2RemoveBodySim)
should_bodies_collide
(b2ShouldBodiesCollide)
sync_body_flags
(b2SyncBodyFlags)
update_body_mass_data
Update a body’s mass, center of mass, rotational inertia, and extents from its shapes. (b2UpdateBodyMassData)
wake_body
Wake a body’s solver set if it is sleeping. Returns true if the set was woken. (b2WakeBody)