Here is how I solved this for anyone who may find this in the future.
# scales the Spatial by the amount in the given global direction
func scaleDirection(amount: Vector3, camRot: Vector3):
var selfQuat = transform.basis.get_rotation_quat() # get the global rotation
var sclXform = Transform(selfQuat) # make it a transform so we can apply it to a vector
var globalScale = sclXform.xform(scale) # convert local scale to scale on global axis'
globalScale = globalScale.abs() # scale should always be positive but rotation can make it negative when converted to global
# when camera is behind the object axis direction must be inverted:
if(camRot.y < 0):
amount.x = -amount.x
if(camRot.y > 90 or camRot.y < -90):
amount.z = -amount.z
# calculate new scale amount because we are not setting the scale directly
var newScale = -amount + globalScale # invert amount here to change side which moves
# actually apply changes
With this function applied to a Spatial you can set the input value
amount to how many units you would like to scale the Spatial in global coordinates. It is not a ratio, for example if your Spatial was already 5 units long on the global X axis and you set
amount to (2,0,0) it would scale your Spatial so it was now 7 units long on the global X axis. It should work no matter the Spatials starting rotation or scale. The camera stuff is optional depending on your use case.
Please let me know if there is a simpler way to do this, I have a feeling I have over thought it, but hey, it works!