Camera - change look_at from editor (and actual editor viewpoint)

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

Hello,

Is there a way I can change a Camera’s look_at() “property” in the editor and see the change instantly in the editor viewport ? similar to Translation or Rotation Degree ?

I tried using the editor export keyword /feature by adding this :

export( Vector3 ) var mylookat setget my_var_set
func my_var_set(new_value):
	self.mylookat = new_value
	print("Value changed in editor")

but not to avail, i just get set mylookat in the debug window.

From this :

For this, GDScript provides a setter/getter syntax using the setget keyword. It is used directly after a variable definition. Whenever the value of variable is modified by an external source (i.e. not from local usage in the class), the setter function (setterfunc above) will be called. This happens before the value is changed. The setter must decide what to do with the new value. As said local access will not trigger the setter and getter. Here is an illustration of this:

func _init():
    # Does not trigger setter/getter
    my_integer = 5
    print(my_integer)

    # Does trigger setter/getter
    self.my_integer = 5
    print(self.my_integer)

I can’t really see the difference here, neither how to see the effect of lookat() immediately from the editor (but think it should be doable).

Thx.