0
\$\begingroup\$

I'm currently trying to learn some Physics2D in Unity. Now, I've created a Ball (sprite) and added a RigidBody2D and a CircleCollider2D on it.

The RigidBody2D has the following settings:

  • Bodytype: Dynamic
  • Simulated: true
  • Use Auto Mass: false
  • Mass: 1
  • Linear Drag: 0
  • Angular Drag: 0
  • Gravity Scale: 25
  • Collision Detection: Continous
  • Sleeping Mode: Start Awake
  • Interpolate: None

Now, when I start the scene, the ball drops as expected. However, it's also moving on the x-axis by ~83 pixels, which I don't want. The movement on the x-axis stops once it reached that ~83 pixels point.

If I freeze the x-position in the Rigidbody2D-Settings I get the intended behaviour (ball just dropping on y-axis), but I feel like that would be a hack instead of fixing the actual problem.

What could cause this? I expected the ball to just drop, if I have no drag, a certain mass and gravity enabled.

\$\endgroup\$
0
\$\begingroup\$

Found the solution. The object was colliding with the background it seems.

\$\endgroup\$
  • \$\begingroup\$ Next time, try to reproduce the problem in a new empty project first. That will ensure that the information/instructions you include in your question are sufficient to reproduce it and diagnose a cause, and will often help you isolate the problem yourself in the process. \$\endgroup\$ – DMGregory Jun 1 at 12:31
  • \$\begingroup\$ Please accept your answer. \$\endgroup\$ – Mohammad Zamanian Jun 2 at 9:59

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.