- Home /
Advanced Camera Rotation
So i am working on a simple 3rd person character controller and i've got the basics almost done.
i can rotate him around with my left analog stick but he does'nt rotate around his own axis. I basically set the rotation of the player to the angle of the analog stick
float xAxis = Input.GetAxis ("Horizontal Joystick");
float yAxis = Input.GetAxis("Vertical Joystick");
float angle = Mathf.Atan2 (xAxis, yAxis) * Mathf.Rad2Deg;
transform.rotation = Quaternion.Euler(0,angle,0);
so my question is now: Because the angle of the analogstick does'nt change with the camera, is there some way to make it happen?
If my camera is in this position like it is in the picture, is it possible if i press the analog stick up, to change the rotation according to the camera?
I really suck at explaining things. Any clue or hint or even the slightest nudge in the right direction is highly appreciated :)
Thanks in advance :)
Oh, i forgot to mention, The Line Renderer is pointing is facing to the rotation of the player
Answer by jvo3dc · Nov 03, 2015 at 09:17 PM
You probably don't want to set the rotation quaternion directly. Why not use transform.Rotate instead?