0 votes

I'm generating spawn points in a volume in a Scene. I'm storing the coords in a Vector3.

How do I relocate a node to that global position? I think it's something like:

 var spawn_point = Vector3(-11, 0, 4)
 var clone = character.duplicate()  
 clone.translate(spawn_point - character.get_global_transform().origin)

The character I'm cloning is scaled and transformed in the scene already.

in Engine by (204 points)

does clone.transform.origin = spawn_point not work?

Thank you! That put me on the right track

1 Answer

+2 votes
Best answer

Not sure why you duplicate it, but you can set its translation:

clone.translation = spawn_point

If your spawn point is in world space but clone is not in world space (for example, if it has a parent that is not at the origin), you can do this:

clone.global_transform.origin = spawn_point

by (28,733 points)
selected by

Thanks, working. Part of the problem was that both my original object and the spawn area had parents that were rotated and that was throwing out the transforms.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.