Problem with rotation

I’m trying to make rotation in one object , using one point as reference. I would that the forward from my object is always the point of reference . Here is the code that i’m trying to make it work.

compañero.transform.rotation = Quaternion.Slerp(compañero.transform.rotation, Quaternion.LookRotation(Luces.transform.position), 1f);

Compañero is object that i’m trying to make rotate
luces is reference point that i would the object look at

The first parameter of LookRotation needs to be a direction, not a position. You need to calculate the forward direction that you want. In this case, I’m guessing it should be:

(Luces.transform.position -  compañero.transform.position).normalized

Basically, to get the direction, you just need to subtract the object’s position from the target’s position to get a vector. Then normalize that vector.

Edit: For the purpose of LookRotation, I don’t know whether it needs to be normalized to work.

No, it does not need to be normalized. Though it doesn’t really hurt on modern hardware ^^. In many cases you need the normalized direction for other things anyways.

I believe it needs normalising if you want to compare the desired forward vector with the current forward vector. However if you are merely setting the forward vector to = -(positionA - positionB) it will result the correct direction.

I stand Incorrected.

if (Vector3.Angle(OBJECT.forward, DESIREDFORWARD) < BUFFER)

At less than buffer you can go ahead and set the forward to the desired forward, Greater than buffer you can

OBJECT.transform.forward += (OBJECT.transform.right * RATEOFTURN);

Eventually you are within the buffer.

here is example of results