Nphysics2d - "apply force at point" does not rotate the rigid_body

Hi,

I’m trying to apply a force with an offset to the center of the rigid body. I would expect that the torque would rotate the body but it doesn’t happen. The body only moves in the force direction. Maybe I’m doing something wrong, here is my code (nphysics “0.14” - nalgebra “0.20”):

Init

let rb_desc = RigidBodyDesc::new()
    .translation(Vector2::new(0., 50.))
    .gravity_enabled(false)
    .mass(400000.);

Apply force and render

let force_vector = Vector2::new(1500000., 1500000.);
for each step {
    rigid_body.apply_local_force_at_local_point(0, &force_vector, &Point2::new(0., -50.), ForceType::Force, true);

    //Render
    amethyst_transform.set_translation_x(rigid_body.position().translation.x);
    amethyst_transform.set_translation_y(rigid_body.position().translation.y);
    amethyst_transform.set_rotation_z_axis(rigid_body.position().rotation.angle());
}

Thanks!

Hi!

Looks like you set the mass of the rigid body but not its angular inertia. An body with zero angular inertia is assumed not to be rotatable. You can set it at initialization time with: .angular_inertia(...).

That’s it. I see a rotation now. Thanks for the really quick answer.