Still cannot get proper location of an instanced child node

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Sir_Skurpsalot

I have a script where I lerp the camera from one position to another on a character scene. If I use any position that is a part of the character, it works fine. If I use a position on a gun scene that is instanced and made a child of the character’s hand, the camera basically goes to the ground. What gives?

func _physics_process(delta):
	var end
	if aiming == true:
		var weapon = strongHand.get_child(0)
		var weaponSkeleton = weapon.get_node("Armature/Skeleton")
		var gunCam = weaponSkeleton.get_bone_pose(weaponSkeleton.find_bone("GunCam"))
		end = gunCam.origin
		end = camAttachment.get_translation()
	var camPos = camera1.get_translation()
	var start = camPos
	var lerpPos = start.linear_interpolate(end, delta * 20)
	camPos = lerpPos

You might want to try using global coords for your case.
e.g. camattachment.get_global_transform.origin to get global coords of an object and e.g. camattachment.set_global_translate(vector) to set global transform origin.

gmaps | 2019-09-15 00:58