Hey all,
Just started using the new 2D features in Unity- They’re great! However, I seem to have an issue. When I add a rigidbody 2D, the default gravity seems very, very low. So I end up setting the scale to something like 10 or 15. This feels better, but then my jump code gets all wacky because I have to have crazy amounts of force to account for the gravity.
Is this correct? Is default gravoty just really low? Gravity is set to default value in the project settings. I just watched 5 or 6 tutorials and no one else seems to have this issue.
The reason is because Unity Physics Engine uses 1 unit as 1 meter. So if your object would normally be half a meter but in game you give it a scale of 50, then the speed of gravity will look very slow. If you need to keep a high scale on the items you can just change the gravity foce according to your scale size.
In Unity:
Edit -> Project Settings -> Physics
and set the Y value of the Gravity Vector
This was actually my fault- I was overwriting the rigidbody2D’s velocity.y with my own without realizing it. D’oh! Works perfectly like this:
characterVelocity = new Vector2 (xMov * speed, rigidbody2D.velocity.y); // where y is gravity
rigidbody2D.velocity = characterVelocity;
“Slow” gravity means your objects are scaled wrong (which applies to 3D physics as well). For the default gravity, with a gravity scale of 1, to look “right” for probably most objects, they should be 1-2 units in size. A 100 pixel sprite for example would have the pixels-to-units setting as 100, so it ends up with a scale of 1.
I also had the same problem but this was my fault too.
my object was falling but also it was moving upward. hence the slow gravity.
In a 3D environment you can add this in FixedUpdate()
rb.AddForce(new Vector3(0, -1, 0) * gravityFactor, ForceMode.Acceleration);
Where rb is the RigidBody