Why is my character sliding? (Rigid Body)
Whatta finna pop?
I have an issue with my game development. You see, I just created a movement script for my character. He is a rigid body object. He only has an empty with a camera parented to him. This is my script:
void Update () {
if (Input.GetKey("w"))
{
rb.AddForce(0, 0, 3000*Time.deltaTime);
}
if (Input.GetKey("s"))
{
rb.AddForce(0, 0, -3000*Time.deltaTime);
}
if (Input.GetKey("a"))
{
rb.AddForce(-3000*Time.deltaTime, 0, 0);
}
if (Input.GetKey("d"))
{
rb.AddForce(3000*Time.deltaTime, 0, 0);
}
}
Again, my issue is that he just keeps on sliding! He slides a lot after I hit a key. What should I do?
Comment
Answer by Pandaa2610 · Feb 22, 2018 at 08:10 AM
Instead of rb.AddForce try Transform.Translate
https://docs.unity3d.com/ScriptReference/Transform.Translate.html
Your answer
Follow this Question
Related Questions
,Why is my character sliding? (Rigid Body) 0 Answers
Jump is higher then normal 0 Answers
How to make Rigidbody movement not slippery? 4 Answers
Stopping Moving Objects? 0 Answers