Setting viewport camera to follow player

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

I am working on a simple space combat game and am trying to use two viewports to set up an X-Wing style front and back radar display. I am trying to set the camera to follow a Position3D node that is attached to the player craft (called “Striker”). However, when I used the code

onready var front_radar_position : Node = get_node("/root/Main/Striker/radarFrontPosition")

onready var front_radar : Node = get_node("/root/Main/HUD/ViewportContainer/Viewport/radarFront")

func _process(delta):
front_radar.global_transform.orgin = front_radar_position.global_transform.origin

I get an "Invalid set Index ‘origin’ (on base: ‘Transform’ with value of type ‘Vector3’ error. It also doesn’t matter if I place the code in the Main scene and reference the children from that script. I still receive the same error.

Any help you could give would be greatly appreciated. Thank you!

:bust_in_silhouette: Reply From: bogdan000

You misspelled origin.

You have got to be kidding me. Wow, well, that did the trick. Thank you so much for noticing and replying. Can’t believe I missed that!

Rezolution | 2021-10-07 17:30