Hello, I'm new to this forum! I'm using Godot's version 4.1.1 Stable.

I'm having difficulties with the "look_at" and "look_at_from_position" function.

I've seen these functions being used in several tutorials and websites, but the compiler is displaying the following message in every attempt I made: Function "look_at()" not found in base self.

Does anyone know if this function has been disabled and/or replaced in this latest version? What am I doing wrong?


Thanks in advance for the answers!

  • Node does not have a look_at function. That wouldn't make any sense since Node doesn't have a position either. You will want to use either Node2D or Node3D.

Node does not have a look_at function. That wouldn't make any sense since Node doesn't have a position either. You will want to use either Node2D or Node3D.

    Zini I am suffering up with this simple Node.
    After this adjustment, I have this error here in "global_transform.origin".

    My object is to make this 3D object look at the Camera. Just that.


    target is null. Something about your node path is wrong.

    I put the code in the right place: 'player_ratinho/camera_mount/Camera3D'

    The structure of the scenes are separate. Camera3D is inside the Player scene and the Player scene is inside the Game Scene;

    And the object that will look at the camera is within the scene of an Item, which is within the scene of a scenario and this scenario is within the Game scene;


    In my view it is well divided... But now to get the right path is what complicated it, right?

    If the script you posted is attached to the node point_look_at, then the correct path would be:
    @onready var target = $"/root/game_rats/player_ratinho/camera_mount/Camera3D"

    There might be another problem. The variable target is initialized when the node point_look_at is "ready". But the node Camera3D might not be in the scene tree yet.

      DaveTheCoder This change of the Target path solved my problem! Thank you for the patience!!! =D

      @onready var target = $"/root/game_rats/player_ratinho/camera_mount/Camera3D"

      Then I just need to change the rotation of the object and I got the expected result!