0 votes
var new_player = player_scene.instance()
new_player.set_mode("free")
get_parent().add_child(new_player)
new_player.global_transform.origin = $ReleasePosition.global_transform.origin
print($ReleasePosition.global_transform.origin)
print(new_player.get_global_transform().origin)

I try to instanciate a new node at some point3d position.
However, even if my print seems good the new node doesn't appear at the desired position.
What am I doing wrong?

(Sorry for my English which is not my native language)

in Engine by (12 points)

Check your player scene, make sure its visual nodes aren't offset from the root.
If not, then the problem is outside your code sample.
It might also depend on what type your player node is, or maybe something else is changing its position (other scripts? Animation? Rigidbody?).

Thanks Zylannn
My player is a kinematicBody, I apply gravity and use moveandslidewithsnap()
Still stuck tho, here is my project's github and branch: https://github.com/bitsAndSketches/grow/tree/move_on_wall

Please log in or register to answer this question.

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.