- Home /
Rotation speed on turret aimed at cursor
I have a turret turning as it aims at the cursor position, but I need a way of slowing down the rotation as it now moves instantly to where the cursor is. Any ideas on how this can be done?
var mousePos = Input.mousePosition;
turretbottom.LookAt(Camera.main.ScreenToWorldPoint(Vector3(mousePos.x, mousePos.y, zDistance)));
use the Vector3.Slerp: http://docs.unity3d.com/Documentation/ScriptReference/Vector3.Slerp.html
also, give it proper parameters in order to move it in your desired rate.
Answer by EvilSquid · Sep 23, 2013 at 02:55 PM
If you're using the built in mouse look script you can adjust the sensitivity in the inspector. If you're not then I suggest looking into it. It may prove an easier solution :)
Your answer
Follow this Question
Related Questions
Turret AI script off rotation 1 Answer
Slerp Problem?: Enemy in Constant Rotation! 1 Answer
Turret on Tank rotating fine until I'm not flat on ground 1 Answer
using a custom rotation in "Instantiate" 4 Answers
Smooth rotation in 90° increments 0 Answers