MouseTorque

Author: Robert Grant (rhgrant10)

Description
This is just a mouse look script, but instead of rotating the object directly, moving the mouse applies torque to the object, thereby rotating it indirectly using the physics engine. Useful for very smooth rotation of the camera, as well as applications involving spaceship-like control.

Usage
Basically, use this script just like any other mouse look script. There are horizontal and vertical sensitivity settings that can be adjusted to give the desired effect. Negative sensitivities invert the axis, and zero will disable rotation on that axis. Since coordinated movement through the application of forces is not always straightforward (in this case, the object tends to wobble away from being upright), there is a corrective force that acts to keep the object upright. Just like the sensitivity settings, setting the strength to zero will disable this corrective force. Some of the adjustments that control the resulting rotations are the properties of the rigidbody, mainly angular drag. If using the default sensitivity and strength values in the script, a good angular drag is probably around 5 or 6, but I've only tested that with my mouse on my computer, so your results may vary!


 * Note: it is possible for the object's rotation to become slightly unstable. Using higher angular drag and corrective strength reduces the effects and frequency of the instability.

Play with the sensitivities, strength, and angular drag settings until you get the desired result.