This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

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:

        var oldPosition = get_node("LowPolyDiceC").get("dicePosition")
        var targetPostion = get_node("pirateShip").get("shipPosition")
        var newDirection = targetPostion-oldPosition

        # This one only moves a tiny bit, and not in the right direction.

        # This one doesn't move at all.

        # This one rockets it towards the ship, then it falls off the table.

        # 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!


in Engine by (12 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.