Erik77
Erik77

Reputation: 109

How to find a node outside of the parent in get_node function?

Im using Godot Engine, i have encountered a problem. I want to acess a node outside of my parent i assigned the script to. My current nodes

I have assigned my script to player and i need to access ThirdPersonCamera. But i cant move ThirdPersonCamera into player because its an interpolated camera and needs to move freely.

onready var camera1 = get_node("Head/FirstPersonCamera")

This is my first camera which i can acess, because its a child. But how do i access the ThirdPersonCamera?

Upvotes: 0

Views: 4060

Answers (1)

AmzingTobuscus
AmzingTobuscus

Reputation: 26

onready var camera2 = get_node("../ThirdPersonCamera")

The .. will select the parent node and from there you can select the child of the parent and in this case the camera node

Upvotes: 0

Related Questions