# Pathfinding

## Recommended Posts

I am creating a game to test, there is no scenario, obstacles and nothing.
My question is that I'm trying to get an object to move to a certain coordinate I want.

Example, I want to move a ball to the coordinates of DestX, DestY and DestZ.

I've looked a lot for pathfinding, but I can not find anything that solves my problem. I just think moves executed by the keyboard arrows, I need to set the coordinates and this object should get there

##### Share on other sites

• 4 years later...

To solve this issue, we need to understand a little we know:
where is the front and back side of the object;
the current position of the object;
the angle by which the object is rotated.
the distance the object must cover.
Additional data needed. Then we introduce the concept of a quarter. It's no secret that in a two-dimensional Cartesian coordinate system there are 4 quarters, from 1 to 4 respectively. In each quarter, the axes have different signs.

##### Share on other sites

Once you explain everything to yourself, you can proceed directly to the script. As input, we take the Transform of the original object after the rotation and the Transform of the empty, to which we will subsequently move. The empty initially has the coordinates of the object. Next, we determine the quarter in which the front of the object is located. Since the trigonometric circle is limited from 0 to 360 degrees, this is not difficult. Having determined a quarter, we calculate the angles of inclination for each coordinate. Then we check that our angles have the correct sign. After that, we send the tilt angles to the final formula for calculating the coordinates. And finally, we set new coordinates to the empty, to which we will interpolate.

##### Share on other sites

For fresh topic ideas, formatting guidelines, citation tips, and inspiration, see https://writinguniverse.com/free-essay-examples/scientific-method/
I like the user-friendly interface, everything is arranged. The material is varied and well presented.

##### Share on other sites

• 1 month later...
On 2/17/2022 at 11:36 AM, Olloverr said:

To solve this issue, we need to understand a little we know:
where is the front and back side of the object;
the current position of the object;
the angle by which the object is rotated.
the distance the object must cover.
Additional data needed. Then we introduce the concept of a quarter. It's no secret that in a two-dimensional Cartesian coordinate system there are 4 quarters, from 1 to 4 respectively. In each quarter, the axes have different signs.

Im making a java game, and the objective is to doge bullets. Im wondering if there is any easy way to use .getX() and .getY() of a specific object to make the bullet move towards that object? Im trying to have the bullet either chase the players X and Y coordinates or get the players coordinates and go to those. I am very new to java, so the more simpler the better. I have tried a few scripts from different forums, but nothing seems to work. So far I have just been rendering rectangles for my bullet and character.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.