Crate wrapped2d [] [src]

Bod2D for Rust

You won't find a lot of information about Box2D itself here, look at the official website instead.

World

use wrapped2d::b2;
use wrapped2d::user_data::NoUserData;

let gravity = b2::Vec2 { x: 0., y: -10. };
let world = b2::World::<NoUserData>::new(&gravity);

Handles

Bodies, fixtures and joints are accessed through handles and their borrowing is dynamically checked by RefCells.

let mut def = b2::BodyDef {
    body_type: b2::BodyType::Dynamic,
    position: b2::Vec2 { x: 10., y: 10. },
    .. b2::BodyDef::new()
};

let handle = world.create_body(&def);
let mut body = world.body_mut(handle);

let shape = b2::PolygonShape::new_box(0.5, 0.5);

let handle = body.create_fast_fixture(&shape, 2.);
let fixture = body.fixture(handle);

Modules

b2
collision
common
dynamics
user_data