Hi
I am working on a little game where a character’s glass eye needs to look at wherever the player touches the screen. For some reason my code works in reverse. The eye looks away from where the player touches the screen. I know it must be really simple, like putting a minus somewhere, but I can’t figure out where.
function Update () {
for (var touch : iPhoneTouch in iPhoneInput.touches) {
var ray = Camera.main.ScreenPointToRay(touch.position);
var hit : RaycastHit;
Physics.Raycast (ray, hit);
transform.rotation = Quaternion.LookRotation(transform.position - hit.point);
}
}