Question by
blueSquid_Games · Sep 21, 2015 at 07:55 PM ·
c#movementmouserotate
Rotating object on z axis only when following mouse movements.
This is the script i am using currently;
void Update()
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(ray.direction), speed * Time.deltaTime);
}
When using this it also effects the X axis rotation, when all i want it to change is the Z axis. Think of it like a tank turret only rotating around, that's the effect i want.
Any help is appreciated. :)
Comment