2d ball not falling

I don’t know why nothing happens with my 2d ball, I have put a rigid body on it. everything is off mass is 100, but he stays in his place.

1 Like

Is gravity off? :slight_smile:

No i tried to add gravity to 1 nothing happens

Okay, is body type set to dynamic?
I opened a scene, added a new sprite… attached the UI knob to it (because it’s simple).
attached a rigidbody2d and started the scene and it falls down :slight_smile:

check Physics2D project settings. value of y is -9.81

Works now thanks.

Cool, glad ya got it working. I saw your last update, but you must have fixed it since then. :slight_smile: Good stuff.

If it is not a big deal, I got other little problem here.
I write this code for a 3d ball, not I made a new project with a 2d ball and used the same code, and it’s giving me an error.
Maybe you can take a quick look.

: error CS1729: The type UnityEngine.Vector2' does not contain a constructor that takes 4’ arguments

:slight_smile:
so, instead of 3 parameters for Vector2, you want 2. Then, you want to close the bracket before your ForceMode. then it should be all good :slight_smile:

I try searching up errors myself but I can’t find solutions.

error CS1503: Argument #2' cannot convert UnityEngine.ForceMode’ expression to type `float’

I gave him 2 parameters.

this.GetComponent<Rigidbody2D> ().AddForce(new Vector2 ( 30, ForceMode.Impulse));

Well, that wasn’t exactly right either, sorry. You need 2 parameters for the Vector2 (instead of before you had 3 + the impuse).
So 2 for the Vector2, then you close the bracket, then a comma, and finally : ‘ForceMode.Impuse’ (to finish the ‘AddForce’ method :slight_smile:

like: GetComponent<Rigidbody2D> ().AddForce(new Vector2 (0, 30), ForceMode.Impulse);