How to properly set a node3d origin

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By treppenwitz
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)

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?).

Zylann | 2020-11-12 16:55

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

treppenwitz | 2020-11-13 07:48