I’m trying to rotate the arm (plane) object in z axis using the x and y positions of the mouse. I did the same thing in c++ language a while a go, but I feel like there might be an easier way in unity.
I tried this code in my arm object, but it rotates in x and y axis. opposite of what I want.
var position = Input.mousePosition;
newposition = Vector3(position.x,position.y,-camera.main.transform.position.z);
var lastposition = camera.main.ScreenToWorldPoint(newposition);
transform.LookAt(lastposition);
Has anyone did something similar?
Thanks