look_at_from_position unexpected behaviour

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Brengar

Hello! I am trying make 3d node look at another node.

light.translation = Vector3(0, width * 5, 0)
light.rotation = Vector3(deg2rad(-90),0,0)

This code is working just fine but it harder to use if i will move node.

light.look_at_from_position(Vector3(0, width * 5, 0), Vector3.ZERO, Vector3.UP)

This code do nothing and i dont understand why.
In my head they will do same thing: move node upward and look down, but second code just do nothing, even if i change position/rotation of node it wil not override it.

:bust_in_silhouette: Reply From: samildeli

It does something. You should be getting this error:

look_at, or in this case look_at_from_position can’t have the vector towards target and up parallel to each other, or else it wouldn’t be able to determine its rotation after looking at the target.

The actual equivalent of your first piece of code is this:

light.look_at_from_position(Vector3(0, 5, 0), Vector3.ZERO, Vector3.FORWARD)