I'm working on a VR game. When the player grabs an object, I'm using a Tween to move the object from it's current location/orientation into the player's hand. I'm using follow_property like this:

	$Tween.follow_property(item, "transform",
		item.transform,
		hand, "global_transform",
		5,
		Tween.TRANS_QUART, Tween.EASE_IN_OUT)

This almost works, the item ends up in the right place, but it gets distorted as it moves. I was going to try following_property with item, "translation", but there is no "global_translation" for it to follow. Is lerp () a better option for something like this? Any suggestions or pointers to tutorials would be great.

https://youtu.be/soLOObXLE90

Welcome to the forums @chrisbare!

I'm not sure if this is causing the distortion, but maybe try setting the global_transform instead of transform initially? It might be that a scale difference or something is causing the issue:

$Tween.follow_property(item, "global_transform",
	item.global_transform, hand, 
	"global_transform",
	5,
	Tween.TRANS_QUART, Tween.EASE_IN_OUT)

I'm not sure on why it's getting distorted, but you might be able to tween the origin property of the global transform.

There isn't a global translation property, but you can access the global position of a Spatial node through global_transform.origin, but I'm not sure if it would work through a Tween. It might work though.

I found a way to make it work. First re-parent the item to the players hand, then reset it's global transform so it doesn't actually move. Finally use a Tween to call a function to move the item toward the origin and basis.


    	var original_transform = item.global_transform
    	hand.add_child(item)
    	item.global_transform = original_transform
    	#animate item moving into "hand"
    	$Tween.interpolate_method(self, "home_item",
    		0, 1,
    		1,
    		Tween.TRANS_SINE, Tween.EASE_IN_OUT)
    	$Tween.start()
    func home_item (weight):
    	var endv = Vector3 (0,0,0)
    	var endb = Basis.IDENTITY
    	item.transform.origin = item.transform.origin.linear_interpolate (endv, weight)
    	item.transform.basis = item.transform.basis.slerp (endb, weight)

a year later