I want to turn seeker in place when reached path.
I test this code. but It doesn’t work.
How can I?
I’m using rotation 2D.
void TurrningWhenReached()
{
// AI is AIPath
if (AI.reachedEndOfPath == false) return;
Vector3 lookpos = transform.position;
lookpos.x += dir.x;
lookpos.y += dir.y;
Quaternion rot = AI.SimulateRotationTowards(lookpos, AI.rotationSpeed * Time.deltaTime);
AI.FinalizeMovement(transform.position, rot);
}
this function called in Update function.
I test with add some log in AIBase::FinalizeRotation function.
and I can check call 2 times (from my code first, and next AIBase::FixedUpdate).
How can I rotate Seeker in place?