LookAtMouse

Author: capnbishop

Description
This script will cause an object to rotate towards the mouse cursor along it's y axis.

This action could be good for third person games where objects need to point to the cursor but remain parallel with the ground. For instance, a sentry gun located in the center of the screen that rotates toward the mouse to target oncoming enemies.

Usage
Drop this script onto a GameObject to have it look toward the cursor. Change the speed value to alter how quickly the object rotates.

C# - LookAtMouse.cs
This is a direct copy of the Javascript function implemented in c#