Question by
sgrgame · Jul 27, 2019 at 06:03 PM ·
scripting problemplayerscripting beginnercontrolscriptingproblem
Own player controller script let the view wobbles but why?
Hello Unity friends,
I have an problem with my little player control script when i rotate and move the player in one time.
The nice fail can you see here: https://kacklappen.tinytake.com/tt/MzY2ODcxNF8xMTEyOTcyMg
and my 'nice' script can you see here:
private void Update() // rotate part - actually rotate only on y axis
{
vert = Input.GetAxis("Vertical");
hor = Input.GetAxis("Horizontal");
yaw += rotSpeed * Input.GetAxis("Mouse X");
transform.eulerAngles = new Vector3(0, yaw);
}
private void FixedUpdate() // move part
{
if (vert == 0 && hor == 0)
return;
transform.position += ((transform.forward * vert) *moveSpeed + (transform.right * hor) * moveSpeed);
}
Thank you for help :)
Comment
Your answer
Follow this Question
Related Questions
How to rotate RigidBodyFPSController (C#) 1 Answer
Try part of C# not being Read 1 Answer
UnityCar - Controlling Speed with a duration? 2 Answers
Script error 0 Answers