[SOLVED] lookAt() behaving oddly

When using the lookAt() function to point towards an entity I get unexpected behaviour

does anyone know a solution to this?

(the entities it’s trying to point at are level relative to the knob’s orientation)

Hi @Mavros!

Can you show the code you use for this function?

Make sure the entity has no dynamic rigidbody.

    this.knob.lookAt(this.targets[this.currentTarget].getPosition());

both the knob and the targets don’t have any rigidbody components on them

Alright. Please note that lookAt() works backwards, so you probably also need to rotate the enity 180 degrees.

it’s working now


I had to keep all the targets flat (globally) and after that rotate the knob however many degrees to match the incline. otherwise it would ignore the incline. Thanks so much!

1 Like