0 votes

I expected

Vector3(weilder.translation.y,weilder.translation.y+1.925,weilder.translation.z)
to_global(weilder.get_node("Head").translation)

to output the same thing because they should be but it is always slightly off. Maybe I am misunderstanding

to_global()

I need it to be global because the gun is a child of the head which is a child of the player, who exists on the root node, but since the player sends a signal with itself as the parameter (wielder), I should be able to get the position of the wielder so the gun can shoot from the welder's head position.

.

asked Jun 15 in Engine by Gamepro5 (46 points)

1 Answer

+1 vote
Best answer

2 problems:

1) You're using (translation.y, translation.y+1.925, translation.z), so you've lost the x-axis.

2) It's much easier to get a Spatial's global position using

global_transform.origin
answered Jun 15 by kidscancode (17,164 points)
selected Jun 15 by Gamepro5
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.