pub fn create_circle_shape(
world: &mut World,
body_id: BodyId,
def: &ShapeDef,
circle: &Circle,
) -> ShapeIdExpand description
(b2CreateCircleShape)
Examples found in repository?
examples/demo_scenes.rs (line 46)
33fn add_circle(world: &mut World, x: f32, y: f32, r: f32, density: f32) -> i32 {
34 let mut body_def = default_body_def();
35 body_def.type_ = BodyType::Dynamic;
36 body_def.position = m::to_pos(m::Vec2 { x, y });
37 let id = create_body(world, &body_def);
38 let mut def = default_shape_def();
39 def.density = density;
40 def.material.friction = 0.3;
41 def.material.restitution = 0.2;
42 let circle = box2d_rust::collision::Circle {
43 center: m::VEC2_ZERO,
44 radius: r,
45 };
46 create_circle_shape(world, id, &def, &circle);
47 get_body_full_id(world, id)
48}