I'm trying to make a small 2D game with a rolling ball/sphere using Unity 5.1, but if find the angular velocity of the ball weird.

On this first image (http://imgur.com/8wBoGms), you can see the sphere in 2D and in its initial position. On this second image (http://imgur.com/ArCRSZn), the sphere was moved by rolling until it made a 90° turn.

But the distance traveled by the sphere is greater than it should, if you wanted to be to be realistic : you can see that the radius of the circle is equal to the size of the squares' sides, so the circle circumference should be equal to ~6.28 (in square side size). If the sphere was traveling realistically, it should travel ~1.57 (in square side size) to turn 90°. But in the second image, we can see that it take 3 and not 1.57 .

The controller of the sphere is simply adding a force when a left or right button is pressed :

public class PlayerController : MonoBehaviour
    public float speed;
    private Rigidbody2D rg2d;

    void Start()
        rg2d = GetComponent<Rigidbody2D>();

    void FixedUpdate()
        float moveHorizontal = Input.GetAxisRaw("Horizontal");

        Vector2 movement = new Vector2(moveHorizontal, 0.0f);
        rg2d.AddForce(movement * speed * Time.deltaTime);

So my question is : how can I make the angular velocity realistic in this situation? Or am I doing something wrong?

Thanks for taking the time, I really appreciate !

  • \$\begingroup\$ You should try to tweak two things in different combinations: 1) angular drag of Rigidbody2D; 2) friction of PhysicsMaterial2D. Second one may help. \$\endgroup\$ – Exerion Oct 20 '15 at 6:02
  • \$\begingroup\$ Angular drag doesn't do anything, but the friction added by the PhysicsMaterial2D seems to work. Thanks ! \$\endgroup\$ – Haerezis Oct 22 '15 at 13:29
  • \$\begingroup\$ I'm gonna make this comment an answer. \$\endgroup\$ – Exerion Oct 23 '15 at 5:43

This is because the sphere has a zero friction and simply slides along the surface. To correct the problem, add PhysicsMaterial2D to your sphere and set friction value greater than zero:

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.