- Home /
Question by
Babilinski · Nov 06, 2011 at 01:17 AM ·
rotationlookatresetc
Rotation Reset
I have a camera look script that it equipped to my characters body so it moves it looks like this
{
if (Input.GetKeyUp (KeyCode.LeftControl)){ // this is changeing from sword to arrows
if (sword == true){
sword = false;
range = true;
}
}
if (Input.GetKeyUp (KeyCode.LeftControl)){ // this is changeing from arrows to sword
if (range == true){
range = false;
sword = true;
}
}
if (Input.GetKeyDown (KeyCode.LeftShift))
shift = true;
if (Input.GetKeyUp (KeyCode.LeftShift))
shift = false;
if (shift == true){
if (range == true){
if (axes == RotationAxes.MouseXAndY){
{
//float rotationX = transform.localEulerAngles.y + Input.GetAxis("Mouse Y") * sensitivityX;
rotationX += Input.GetAxis("Mouse Y") * sensitivityX;
rotationX = Mathf.Clamp (rotationX, minimumX, maximumX);
rotationY += Input.GetAxis("Mouse X") * sensitivityY;
rotationY = Mathf.Clamp (rotationY, minimumY, maximumY);
transform.localEulerAngles = new Vector3( rotationY,rotationX, 0);
}
}
}
}
if (shift == false){
// what do i add here so i can change the rotation back to normal???
}
}
I commented where i need help. I want to get the objects rotation back to 0,0,0. as if the whole look at camera never happend.
Comment
Your answer
Follow this Question
Related Questions
Transform.LookAt and Back! 1 Answer
lookat() issue 1 Answer
Look at an angle 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers