I am trying to snap the rotation of object to left and right, as i keep on clicking i dont know my there is some additional angle is being added everytime i click.
[36546-clicks+of+w.png|36546]
This is weird because after pressing W several time there is some additional angle is being added
104.83 is suppose to be 90, not 104.
what i am trying to do is to move object continuously in the right on x axis. and then with W, D, S keys i want them to rotate in there direction.( i am not using GetAxis because input.Getkey will be replaced by Touch after completion of game for mobile).
This is how i wont them to move
This is my script
using UnityEngine;
using System.Collections;
public class PlayerScript : MonoBehaviour {
public float speed;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
transform.Translate (Vector3.right * speed * Time.deltaTime);
if (Input.GetKeyDown (KeyCode.W))
{
transform.Rotate (transform.rotation.x,transform.rotation.y,transform.rotation.z + 90f);
}
}
}