- Home /
Unity Asset Prefab Bug ThirdPersonController (left rotating bug / Snapping forward Always)
Alright guys,
I dont think I have done something wrong because I set a new scene, added one plane and added the untouched ThirdPersonController.
I took a video because it's little hard to explain. If you face towards X Axes and then turning left, it does snap back to forward, turning right works fine.
Here is the video. https://drive.google.com/file/d/0B6pwzZMTAZQqREsyZTVVSExWZUk/view?usp=sharing
How to fix this....?
played more and figured out:
if you are in rotation 0 0 0 and you look forward. if you move down but with the right side (see picture) there is no snapping.
HOWEVER, if you move down using the left turn, it starts snapping.
JESUS, what crap is this? How could be such a buggie Asset come from Unity -___-
is this supposed to be a feature?
Thanks for any help. Cheers :)
thanks for any help :D
Answer by vinternet2000 · Nov 02, 2015 at 01:56 PM
I think the error is in the Atan() function in ThirdPersonCharacter.Move, which returns the value of Pi when move.magnitude = 0 in certain cases. It seems like it's probably a trigonometry error where it should be returning 0. I fixed the issue with this code:
if (move.magnitude > 0f)
{
m_TurnAmount = Mathf.Atan2(move.x, move.z);
}
else
{
m_TurnAmount = 0f;
}
HOY S$$anonymous$$O$$anonymous$$ES!!! I knew it was something about that $$anonymous$$athf.Atan2 Function but I could never ever figure out how to fix it .
I know my response is later but I so much appreciate your answer. BIG THAN$$anonymous$$S I must have spent about 100 hours for this crap until I decided to leave it unfixed :(
Answer by PhaetonLT · Jan 18, 2019 at 02:33 AM
In my version the solution from reddit worked: https://www.reddit.com/r/Unity3D/comments/2yz9i4/i_found_a_bug_in_the_third_person_controller_and/ if (turnAmount == Mathf.PI) turnAmount = 0f;
Answer by Red_Dragon69 · Sep 17, 2015 at 06:01 PM
Hello, check the Y-Rotation of your camera. If this Rotation is not 0 your character will always drift to the left/right when moving.
This fixed the drifting issue for me.
Best regards :)
Your answer
Follow this Question
Related Questions
Character Controller strange collision bug 2 Answers
Make Third Person Character Rotate 1 Answer
Ensure free camera lines up behind player 1 Answer
MovieTexture black on Mac build 1 Answer
Ui extension bug 0 Answers