- Home /
Question by
Jumper39 · Apr 26, 2014 at 06:50 PM ·
lookatturretmove speed
[Problem] Look at mouse with speedturn
Hi! I have a problem with the script gameobject (Turret) look at the mouse really works, but I want to be out of the tower turn of speed, and here the script: var speed = 15.0;
function Update() {
var position = Input.mousePosition;
newposition = Vector3(position.x,position.y,camera.main.transform.position.y- transform.position.y);
var lastposition = camera.main.ScreenToWorldPoint(newposition);
transform.LookAt(lastposition);
transform.rotation = Quaternion.Slerp (lastposition.rotation, newposition.rotation, Time.time * speed);
}
Comment
Sorry my bad english! I need Turret to max speed of look at mouse. Again sorry my bad english!
Your Slerp isnt working as you are using the LookAt function directly before it, I think.
Your answer
Follow this Question
Related Questions
Rotate Turret to Tag 1 Answer
Simple LookAt Rotation with offset pivot 2 Answers
How to clamp Lookat? 2 Answers
How to make an object to look at Raycast Hit Point? 1 Answer
Turret Rotation Problems 1 Answer