Why are objects not accurately finding another object's center?

I have this script that is supposed to make one object (Enemy) go to another object (Player)'s position, and I would assume that this would result in their centers meeting, but I keep having this issue where they go to Player’s edge instead.

Here’s the rotation script I’m using:

    lookPos = target.position - transform.position;
    Quaternion rotation = Quaternion.LookRotation(lookPos);
    transform.rotation = Quaternion.Lerp(transform.rotation, rotation, Time.deltaTime);

I had the same problem with transform.lookAt();

Neither object is a child.

Also this is my first post so I might’ve done something wrong


A wild guess is that your GameObject’s center isn’t actually where you expect it to be.

For example - When you select the “Move tool” that shows you the 3 axis on a selected GameObject. Does it appear at the center of the object, like you would expect or is it somewhere “off center” ?

Alternatively - is this GameObject a child of another gameobject, which you are moving instead ? In that case it could be that the center of the child object doesn’t align with the parents center.

It turns our the problem was that the pivot point was not the same as the center point, as ProBuilder automatically puts the pivot on a vertex instead. So I remade the object and moved the pivot to the center and now everything works as intended.

Thank you for answering though! :slight_smile: