- Home /
Question by
thorhammer2301 · Apr 20, 2020 at 07:07 AM ·
errorquaternion
Camera touch movement Script issue
private Vector2 rot; private float change = -1f; private float sensitivity = 0.2f; private void FixedUpdate() { if(Input.touchCount > 0) { var touch = Input.GetTouch(0); if(touch.phase == TouchPhase.Moved) { rot += touch.deltaPosition; } } GetComponent<Camera>().transform.rotation = Quaternion.Euler(0, rot.x * sensitivity , change * rot.y * sensitivity ); }*
this is the code i tried for rotating my camera only in x and y axis....its working fine x axis but while i go for y-axis it rotates the screen in anti-clockewise...If you didn't understand how it is rotating in y-axis you can check this in your editor..(just create a 3-D cube on a plane...drag camera inside of cube...and add this above script to the main camera)....how can i correct that...as i'm a beginner..Need help!
Comment
Your answer
Follow this Question
Related Questions
Position errors on rotated child objects? 0 Answers
Help with Quaternions and Vector3s 2 Answers
Quaternion Error, what does it mean? 1 Answer
Gun Rotation 2 Answers