- Home /
how to control the speed of look at
u know the transforml.lookat() ok so how can i control the speed of its rotation
Answer by tool55 · Feb 22, 2011 at 06:05 AM
function Update() {
// Look at and dampen the rotation
var rotation = Quaternion.LookRotation(target.position - transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * damping);
}
You can use this instead of LookAt to turn at a controlled rate. "damping" is a variable you can use to control the speed.
Answer by efge · Feb 21, 2011 at 10:52 PM
I think it is not possible to do that, but you can script your own LookAt and control the speed.
Take a look at the examples of Vector3.Lerp or Quaternion.Lerp as a starting point.
Answer by wgryim · Nov 09, 2020 at 10:05 PM
It can be implemented with RanuTransform easily. Just call
SetBaseAngularSpeed( speed); SetLookAtObject(object) or SetLookAtPosition(position, isGlobal), that's all.
And smooth start or ending can be applied with two more API.(setting acceleration and setting damping mode).
please check it at
https://youtu.be/QrIfl8WzmM8 https://assetstore.unity.com/packages/slug/169250