I’m using an input (Wiimote) that outputs mouse position, rather than direct movement.
Is there a way I can alter the orbit camera script so that direction it faces is controlled by mouse/cursor position as opposed to mouse movement.
Thanks
I’m using an input (Wiimote) that outputs mouse position, rather than direct movement.
Is there a way I can alter the orbit camera script so that direction it faces is controlled by mouse/cursor position as opposed to mouse movement.
Thanks
Managed to get it working with this:
var target : Transform;
var distance = 10.0;
var xDec;
var yDec;
var x;
var y;
function Update () {
xDec = (Input.mousePosition.x - Screen.width / 2) / Screen.width;
yDec = (Input.mousePosition.y - Screen.height / 2) / Screen.height;
x = xDec * 80;
y = yDec * -40;
var rotation = Quaternion.Euler(y, x, 0);
var position = rotation * Vector3(0.0, 0.0, -distance) + target.position;
transform.rotation = rotation;
transform.position = position;
}