How to translate a rigid body to a specific spot?

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

Hi, and thanks for reading my question.

Okay, so I am a newbie at this Godot and 3D engine thing. I took several tutorials, written and video, such as BornCG’s video game tutorial, so I have some rudimentary knowledge, but not much.

I am making a 3D dice game and after the appropriate number is achieved, I want to whisk the dice away to the side of the playing table so it is out of the way. I read through vector math and came up with these options:

$pirateShip.show()
		var oldPosition = get_node("LowPolyDiceC").get("dicePosition")
		var targetPostion = get_node("pirateShip").get("shipPosition")
		var newDirection = targetPostion-oldPosition
		print(newDirection)
		$LowPolyDiceC.apply_impulse(Vector3(),newDirection)
		
		#translate(translation.direction_to(newDirection))
		# This one only moves a tiny bit, and not in the right direction.
		
		#translation.direction_to(newDirection)
		# This one doesn't move at all.
		
		#apply_impulse(Vector3(),newDirection)
		# This one rockets it towards the ship, then it falls off the table.
		
		#translate(newDirection)
		# This one does not go to the ship, but goes up in the sky near it.
		

However, none are quite what I want.

The apply impulse option moved the dice in the right direction, but then it just keeps going. And, if there are other dice in the way, it knocks them over, which I do not want to change the other dice at all.

Using translate, I can magically move the dice, but I am not able to put it where I want. I know this is a math problem, but my vector math is a bit weak. Using the math I have, the dice moves up equal in height with the ship, but off to the side.

So, how do I properly do this math to magically move the dice to a given point (the pirate ship)?

If you need more information, here is my project on GitLab:

and more specifically, this script:

Any pointers are appreciated, I’ve spent several days reading documentation, and I am still stuck. I appreciate you help!

-Alaskalinuxuser