|
hi, I know how to move static objects, with transforms. but how can I move ball with physics. I mean I click forward button[w] and ball rolls forward following terrain. when I click jump[space] it jumps. also can I make ball bounce up and down all the time? I got this effect while messing with physics components and kind of liked it. (very relaxing to watch xD)
(comments are locked)
|
|
To make the ball bounce all the time set its physics material bounciness to 1 and the bounce combine to maximum. To "steer" the ball with physics you will need to either apply forces to its rigidbody or set its velocity directly. Both can be done with member functions of the rigidbody component, which you can look up in the scripting reference. I would suggest using forces for steering and only use velocity for jumping or instantanious speed boosts.
Apr 29 '10 at 05:35 AM
Random Indie
Thx I got it working
Apr 29 '10 at 07:38 PM
Hellwalker
(comments are locked)
|
|
You'll probably want to apply torque to rotate the ball. Then its friction with the surface it is on will convert that into motion. This works when applied to a sphere:
If you instead apply the force directly to the ball, it might seem to work similarly, because the friction with the contact surface will cause it to roll (the inverse of the above). However, on, say, ice, it will accelerate faster (and not roll much). Of course, that might be what your game requires. Thanks bro!
May 02 '12 at 02:33 AM
Chimera3D
Thanks Warwick! But I have a problem with this which is that the ball doesn't stop after applying the AddTorque until it reaches a collider. Given the friction and gravity, It's supposed to lose the energy after a while and stop, but it don't! Could you please help in this issue as well? Thanks.
Oct 01 '12 at 04:12 PM
ebad
(comments are locked)
|
