what am I doing wrong?

I want my robot node to move from one location to another over 10 seconds. But it clearly is moving way slower. func _process(delta): $Tween.interpolate_property($Robot, "position", start, destination, 10, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)

start: (148, 308), destination: (148, 276), delta: 0.02 = time: 10.074613 -> position(148, 297.949982)

it is supposed to be moving 32 pixels in 10 seconds

y position from 308 to 276 = 32 total time expired 10.07 seconds, but it's only gotten to 297, not 276 Why is this so off!

I've never used Tween, but would putting the call in func _physics_process() make a difference?

Tween is supposed to work off of either, and It is currently using func _process(delta):

enum TweenProcessMode:
TWEEN_PROCESS_PHYSICS = 0 --- The tween updates with the _physics_process callback.
TWEEN_PROCESS_IDLE = 1 --- The tween updates with the _process callback.

When are you starting the tween? The 10 seconds should be from the time you call $Tween.start

The Scene tree

and the pertinent code (edited to find out what is going on)

func Operation (Op, Next):
	lastOp = currOp
	currOp = Op
	nextOp = Next
	print ("Robot.Operation: ", lastOp, ", ", currOp, ", ", nextOp)
	if (lastOp == Enums.OperationCard.EMPTY):
		if (currOp == Enums.OperationCard.M1):
			start = position
			destination = position + Vector2(0,-32)
			print ("position = ", position, ", ", destination)
			print ("Start: ", start.y, "destination.y: ", destination.y)
			$Sprite.play("Forward")
			bMoving = true

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
	travel = (destination - start)*delta/32 # 32 pixels over 10 seconds
	if (bMoving):
		time += delta
		print (", delta: ", delta, " = time: ", time, " -> position", position)
		$Tween.interpolate_property(self, "position", start, destination, 10.0, \
			Tween.TRANS_ELASTIC, Tween.EASE_IN)
		$Tween.start()
	else:
		time = 0.0

Looking quickly at the code, I think I know what the issue is. You are calling tween.start every _process call whenever bMoving is true, rather than once when bMoving is true, so the tween is constantly being restarted and only moving a single _process call forward before being restarted again.

Using an additional boolean to detect if the tween has been started should fix the issue:

var did_tween_start = false

func Operation (Op, Next):
	lastOp = currOp
	currOp = Op
	nextOp = Next
	print ("Robot.Operation: ", lastOp, ", ", currOp, ", ", nextOp)
	if (lastOp == Enums.OperationCard.EMPTY):
		if (currOp == Enums.OperationCard.M1):
			start = position
			destination = position + Vector2(0,-32)
			print ("position = ", position, ", ", destination)
			print ("Start: ", start.y, "destination.y: ", destination.y)
			$Sprite.play("Forward")
			bMoving = true
			did_tween_start = false

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
	travel = (destination - start)*delta/32 # 32 pixels over 10 seconds
	if (bMoving):
		time += delta
		print (", delta: ", delta, " = time: ", time, " -> position", position)
		
		if (did_tween_start == false):
			$Tween.interpolate_property(self, "position", start, destination, 10.0, \
				Tween.TRANS_ELASTIC, Tween.EASE_IN)
			$Tween.start()
			did_tween_start = true
	else:
		time = 0.0

Holy moly how could I have missed such a simple logic error, will double check!

Okay, you were right, the problem with modifying the position variable was that the Tween start was happening over and over again. worse yet, if you don't pull the interpolate_property out and call it only once as well, it has unruly behavior. the print shows the position is being updated now correctly over the proper amount of time. However, now my sprite isn't moving according to the updated position tween calculation. the commented out #Travel and #position += is s crude lerp and it works and moves properly. why isn't the tween moving properly? I suspect self is not the right object to be manipulating.

if (bMoving):
		#travel = (destination-start) * delta/10
		#position += travel
		time += delta
		print (", delta: ", delta, " = time: ", time, " -> position", position)
		if (!bTweenStarted):
			$Tween.interpolate_property(self, "position", start, destination, 1.0, \
				Tween.TRANS_ELASTIC, Tween.EASE_IN)
			$Tween.start()
			bTweenStarted = true
	else:
		bTweenStarted = false
		time = 0.0

The problem is the tween is in the Process function. it should be outside of the process function. Then it moves and operates correctly

2 years later