- Home /
MOBILE - FPS Camera Rotation HELP
Hello! I am trying to create a swipe based fps camera. The problem is, the rotation gets all weird.. Like, when the x rotation is 0, the y looks up and down perfect, same vice-versa. I believe that it is because it is rotating using World Space. How could I make it rotate locally? Like, rotate taking in the factor of the other value? Here's the code for better understanding:
public var cam : Camera;
function Update () {
if(Input.touchCount > 0) {
5. cam.transform.Rotate(-Input.GetTouch(0).deltaPosition.y / 2 * 0.69f, Input.GetTouch(0).deltaPosition.x / 2 * 0.69f, 0);
}
}
Comment
The default rotation is in local space, but you can explicitly tell it to rotate in local space by an enumeration. Check this link Transform.Rotate
Your answer
![](https://koobas.hobune.stream/wayback/20220613183505im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Mobile Device Video Camera 1 Answer
iPhone joypad interfering with MouseLook 0 Answers
Mobile FPS Help 0 Answers
Best FPS cap for mobile builds 1 Answer