0
votes

I want to copy the location of a node without the rotation. I could set it as the child, but there is no way to ignore the rotation.

In 2D, I could use the position of one node to set the position of another. Unfortunately I haven't found the 3D alternative. In this post there is a description but it uses legacy Godot code.

There doesn't seem to be a 3D position function for the Spatial node.

The following non-functional code shows what I'm trying to do.

extends Spatial

var target

func _ready():
    target = get_node("Target")

func _process(delta):
    self.transform.position = target.transform.position
1
Check out the RemoteTransform node, too. - hola

1 Answers

0
votes

Eventually I found out how to do it. You can copy the global_transform origin to set it to the same location.

extends Spatial

var target

func _ready():
    target = get_node("../Player/Target")

func _process(delta):
    self.global_transform.origin = target.global_transform.origin