How do you rotate a Spatial node around an axis at a given point in space?

:bust_in_silhouette: Reply From: path9263

Well for anyone else trying to do this here is what I came up with.

obj is the Spatial object you want to rotate.
point is a vector3, the point in world space you want to rotate around.
axis is the axis you want to rotate around, ie y axis would be Vector3(0, 1, 0)
angle is the angle (in radians) you want to set the objects rotation to, not the amount to rotate it by.

func rotateAround(obj, point, axis, angle):
	var rot = angle + obj.rotation.y 
	var tStart = point
	obj.global_translate (-tStart)
	obj.transform = obj.transform.rotated(axis, -rot)
	obj.global_translate (tStart)

Note that if you want to rotate around a different axis other than Y you will also have to change obj.rotation.y to a different axis, this could be modified to support any axis but this is all I need for now.