0
\$\begingroup\$

I am trying to model a ball rolling down an inclined surface in Unity based on what I am observing in real life but it is still quite off.

  1. In Unity it takes the ball about 3 seconds to travel from a place to another specified place where in real life it only takes 1 second.
  2. The ball isn't as fast to react to the incline as in real life (even though I have tried giving the ball and surface low or zero friction values).
  3. The ball does not accelerate nearly as fast as it does in real life.

What do I do to give the ball more realistic behavior ? I have tried messing around with mass, physics materials, drag, and angular drag on the ball and surface but it doesn't seem to help.

\$\endgroup\$
  • 2
    \$\begingroup\$ I think you're looking for gravity? \$\endgroup\$ – Anko Aug 23 '14 at 21:07
3
\$\begingroup\$

I would check your scale. Physics in Unity are designed to work at real life scales (1 unit = 1 meter) If you create a scene that is not to the correct scale, you are going to have a terrible time getting it to look correct.

Example:

Lets assume your ball is supposed to be a basketball. A standard basketball is 23cm (0.23m) If you build everything to scale and have normal gravity it should accelerate at 9.8m/s^2. In game space that would be 9.8 units/second squared.

If you just made the ball the size of a unit sphere and scaled the environment up. It would look visually like everything was correct but, you have done is created a giant (~5x) basketball in a giant world. When you hit play the ball would appear to be affected by gravity at a different rate, 2.254 Units/second squared.

The temptation in this moment would be to try to adjust gravity and the relative masses to compensate for the scale being off. The problem is that PhysX is actually only built to work well at one scale, the real world (1 unit = 1 meter). If you deviate from that standard scale you are going to an increasingly difficult time getting anything behaving correctly.

\$\endgroup\$
1
\$\begingroup\$

Try adjusting the Max Angular Velocity in the Physics Manager.

You can access the Physics Manager by selecting Edit->Project Settings->Physics from the menu bar.

The default value is 7.
Maybe try a value around 100. That seemed to work well for me.

You can override the Project Settings value of Max Angular Velocity for any Rigidbody by scripting Rigidbody.maxAngularVelocity.

I hope this works the way you are expecting! It did for me, but I didn't test the side effects of having set a high value. If anyone here can explain why adjusting the Max Angular Velocity may be a poor decision, please let us know.

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

Anko was right with his comment.

Physics.gravity is a static vector 3 variable that you can change in your code.

http://docs.unity3d.com/ScriptReference/Physics-gravity.html

You can modify gravity along with things like friction and drag to give desirable results.

\$\endgroup\$

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.