Alright, I'm a complete newbie with Unity, and I thought you guys might be able to help.
At the moment, I'm making something along the lines of a small test game, where the player is able to control a ball or marble. I added a rigidbody to the ball, and when i started to script it, I ran into a dead-end.
At first I used rigidbody.AddForce() but it seemed unrealistic.
I tried to get it to move by using rigidbody.AddTorque(), but the ball doesnt seem to roll fast enough. I tried multiplying mainly, but no matter how high i put the numbers, the speed remained the same.
I cant find any other ways to do this. Is there something im missing?
asked Dec 15, 2009 at 03:33 AM
rotation speed is limited by a setting in physics settings. just go to edit/project settings/physics and change the value of max angular velocity. don't set it to a really high value because it can produce errors. i use this code for rolling and it works well
i defined maxspeed, ratio and speed as variables in top of my code. i don't copy whole code because it's C# code and you don't use it. it has many other stuff too. the ratio variable is the ratio between z axis and x axis movements.
the movement is natural even with max angular velocity of 7 (default). don't change the value if you don't have to do so. it can result in a ball that pass other colliders.
answered Dec 29, 2009 at 07:34 AM
If you are using the Iphone version of Unity you can check out the Unity demo Roll-A-Ball:
It's a simple roll-the-marble-past-the-holes type of game.
Even if you aren't using Iphone you may be able to pry some useful tidbits out of it. :)
answered Dec 15, 2009 at 05:14 AM