- Home /
Why is there no gravitational acceleration with Unity 4.3.1 2D?
I've just started using the 2D physics engine in Unity 4.3.1. I've setup several objects with Rigidbody2D some with CircleCollider2D and some with PolygonCollider2D.
What I'm noticing is that, when the objects fall, they appear to fall at a constant speed. In other words, they don't appear to gain speed as they fall like they would in the real world.
Linear Drag is set to 0. Gravity Scale is set to 1.
Is this normal? What settings can I check/set to adjust this behavior?
Not sure what you are seeing. Try this in a new, 2D project and a new scene:
Create a sprite
Add a Rigdibody2D component
Adjust the 'Size' on the camera so that you can see more of the scene.
Add the following script
Hit Play
function OnGUI() { GUI.Label(Rect(0,0,200,50), rigidbody2D.velocity.ToString());
}
I created a new project like you described. The sprite's velocity does increase as it falls until it reaches -100 and then it stays at -100. I went back to my original project to tracked the velocity of a selected sprite. It's velocity also started at 0, but very quickly (about a second) increased to -200 and then stayed at -200.
There is one big difference between the two projects. The test project has the sprite's scale set to 1 and gravity set to -9.81. $$anonymous$$y project has sprite's scale set to 100 and gravity set to -309.81.
There seems to be some sort of maximum linear speed that is set to 100 in the test project and 200 in my project. Is this possible?
This issue of a limit has come up in several questions since 2D stuff was released. The answer seems to be changing pixels per unit for the sprites. Google "unity3d 2D maximum velocity" for a number of hits including this one:
http://answers.unity3d.com/questions/577393/unity-limiting-max-velocity-on-rigidbody.html