0 votes

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.

Godot version 3.3.2
in Engine by (15 points)

1 Answer

+1 vote
Best answer

It does something. You should be getting this error:

the 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)
by (62 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.