Forum

Objects facing each other

hey, how do I do the trick if I want to calculate the xyz rotation of two objects from their positions. they should look at each other.
I tried with LookAt and different confusing transform try outs.

Maybe someone has an idea?

P1 - P2 is the direction vector pointing towards P1. you can use it and its negative with Polar to get the rotations.

on a side note:

LookAt was made for Cameras, so if you want to use LookAt for Objects you have to get the Inverse of it.

faceyourself.v4p (8.1 kB)

Okey thank you both very much…

Here is a patch comparing the two methods.
What Tonfilm said works but the outcome is still diferent… Maybe I understood it wrong.

faceyourself_LookAt vs Polar.v4p (16.4 kB)

you are using the Length as an angle… but that’s just, well, the length of the vector. the two angles are enough.

ah thanks. I updated the file above :)

0.27 ;)… no text …