Hi,
This is my rotation code:
public float speed = 10;
private int timesHit = 0;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow) )
{
timesHit++;
}
if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow))
{
timesHit--;
}
this.transform.rotation = Quaternion.Lerp(this.transform.rotation, Quaternion.Euler(0, timesHit * 36, 0), Time.deltaTime * speed);
}
}
And it works like a charm in rotating my object 36 degrees on the Y axis when I press the designated keys, however it forces the object to start from 0 and I’d like it to start from 3 on the y axis. How can I do that? Any help is greatly appreciated