FPS character spins uncontrollably ,1st person player spinning out of control
Hello! I'm currently making a small project with a friend to learn Unity. We have made a 1st person playermodel that uses physics which uses the following code:
void FixedUpdate () { float translation = Input.GetAxis("Vertical") * speed; float straffe = Input.GetAxis("Horizontal") * speed; translation *= Time.deltaTime; straffe *= Time.deltaTime; transform.Translate(straffe, 0, translation); }
It is using these components:
Our problem is that when the character runs into the corner of a wall or a rigidbody object, he spins uncontrollably until you move the mouse a bit and then he stops. This doesn't make any sense to me because he has X and Z rotation locked. I have also tried locking the rotation in code, but to no avail. It spins uncontrollably nomatter what.
Please advise ^-^
It might be because the character is trying to rotate in the x and z directions, but cannot, so it rotates in the y direction ins$$anonymous$$d. Probably won't help, but try unchecking x and z for the freeze rotation.
Answer by BamBamAlicious · Mar 17, 2018 at 05:01 PM
Change interpolate to interpolate, and collision detection to continuous. Then up the angular drag to about .5 and see if that corrects it.
Unforunately it did not fix it, and the character can walk through walls if you hold W into it for a few seconds :/
Could it have something to do with using a Character Controller script ins$$anonymous$$d of a script? Just spitballing here
Your answer
Follow this Question
Related Questions
How do I make my player model rotate based on the direction he is walking. 0 Answers
Character Movement bug. 0 Answers
Colliders Don't Work no matter what 1 Answer
Applying Force to the Character 0 Answers