When I add force character slowly speeds up, which causes a lag to the movement and animation when I press w button and also character slows down slowly, which causes sliding effect. When I use drag it kinda solves sliding effect but also slows down the movement speed. And the other problem character speeds up indefinitely. How can I make AddForce to act directly and at constant speed? I think I need to use AddForce since I want this character to interact with physics later on like falling, getting pushed with blow etc.
Thanks in advance!
You don’t need to use AddForce. As its name implies, it places a force. In the absence of a counter force, an object experiencing a force will accelerate indefinitely. This might be appropriate for a spaceship but probably not for someone walking.
Instead you can use .MovePosition() on your Rigidbody to make it move however much you want each frame.
Instead of reinventing the wheel however, have you looked up Rigidbody character controllers? There’s lots of code examples out there to start from on the interwebs.
1 Like