input.touches

Hello,

I could not write this script for touch button. Can you convert to input.touch?

#pragmastrict

var speed = 45.0;
var rt : Quaternion;

function Start() {
rt = Quaternion.identity;
}

function Update() {
if (Input.GetKeyDown(KeyCode.E))
rt = Quaternion.Euler(0.0, 0.0, 10.0);
else if (Input.GetKeyUp(KeyCode.E))
rt = Quaternion.identity;

transform.rotation = Quaternion.RotateTowards(transform.rotation, rt, speed * Time.deltaTime);
}

Please use CODE tags.

And I think to do what this script does, you’d just need your update method to look like this:

function Update() {
    if (Input.touchCount > 0) {
        rt = Quaternion.Euler(0.0, 0.0, 10.0);
    else {
        rt = Quaternion.identity;
    }
    transform.rotation = Quaternion.RotateTowards(transform.rotation, rt, speed * Time.deltaTime);
}