I’m trying to make a simple IK solution for an archer AI (for aiming) whose animations are generic. Here’s what I have so far:
void LateUpdate()
{
if (enabled)
{
Vector3 lookPos = (EnemyToAttack.position - transform.position) + lookRotationOffset;
Quaternion lookRot = Quaternion.LookRotation(lookPos, Vector3.up);
spine.rotation = Quaternion.Lerp(spine.rotation, lookRot, Time.deltaTime * lookSpeedMultiplier);
}
}
This works fine when I’m debugging it and manually changing lookRotationOffset, but then, afterwards, the AI always looks in the same direction. I’m at my wit’s end on this one, is there a better method of doing this or am I doing something wrong? I’d appreciate any help anyone can give me.
EDIT: I apologize for the weird title, I think it’s my internet connection