- Home /
Locking on a target by rotation
I'm having trouble thinking of how to make a radar (Basically a sphere) locks an enemy slowly.
Just like locking on a target in Flight Simulation games like Ace Combat?
Answer by mohd-ma · May 03, 2014 at 08:38 PM
Use quaternion.slerp
Slerp's motion is curvy. As in, it starts sort of slow, moves fast according to time, then slows again when reaching the target.
Is there a way to have a stable speed? Slow, but constant speed?
Answer by MSpiteri · May 05, 2014 at 11:29 AM
You can use Vector3.MoveTowards
https://docs.unity3d.com/Documentation/ScriptReference/Vector3.MoveTowards.html
Simple example:
transform.position = Vector3.MoveTowards(transform.position, target.position, followSpeed * Time.deltaTime);
I hope this helps.
This doesn't really help because this moves the transform, not rotates it