Hot answers tagged

4 votes

Unity - Where should downloaded level data be stored?

I don't think placing game related files in My Documents/My Games/ annoys users, it's pretty much standard to put it there so why don't you do it? Each user can ...
Madmenyo's user avatar
  • 1,959
3 votes

Help for sorting cars that are 1 lap behind the others (latecomers)

Add a per car lap counter that increments when they hit the finish line. That way you can sort the cars by that lapcount before you sort those with the same ...
ratchet freak's user avatar
3 votes
Accepted

Creating random path in grid

Edit: I just noticed you don't have a fixed endpoint to steer towards. In this case, we can solve this with recursive backtracking: ...
DMGregory's user avatar
  • 132k
3 votes

How to create a boomerang-a-like path?

What about one side of a lemniscate (polar) or a rose curve (also polar)? You can find a refresher on polar curves (and the equations of the curves described above) here (which is where I got the ...
Cpp plus 1's user avatar
3 votes
Accepted

libgdx FollowPath proper usage

Solution I posted an example scenario answer on the linked post but I thought that maybe I should provide a more direct answer on this page. So, as you can see, the green line seems to bend toward ...
Ammar Tarajia's user avatar
3 votes

Lazy way to figure out the two sides of a border?

I believe the solution is simple - mark vertices of the path as impassible and run regular Dijkstra for this input. If it fails to find a path you are sure they are on different sides. Edit: If your ...
wondra's user avatar
  • 4,910
3 votes
Accepted

How can I create a world map like Mario 3's?

I would adjust SPathPiece so that it knows about the nodes it connects. ...
PompeyPaul's user avatar
2 votes
Accepted

How to do multi-agent 2d pathfinding when agents can block each other?

You will need to augment your A-star search to keep track of when tiles will be occupied and in which direction the blocking AI is going. If a path is temporarily blocked at the time it would reach ...
Stephane Hockenhull's user avatar
2 votes

How to find the optimum path, on a road, for a car?

Technique generally used on AAA games to find the best possible path for a given car (because car settings are often all different) is to run an AI that will improve its driving technique. After ...
lvictorino's user avatar
  • 2,624
2 votes

Bike game - following a road path

I don't' think you can avoid the trig really, but what you can do is improve just how you calculate the angle. Your question mentions the "x y coordinates for the bike", but in fact the bike doesn't ...
Tim Holt's user avatar
  • 10.3k
2 votes
Accepted

Pathfinding to unknown destination point

Create an isochrone map (https://en.wikipedia.org/wiki/Isochrone_map), get a polygon of all the points accessible within N units of time. An isochrone map basically looks like this (3 isochrones are ...
fnicollet's user avatar
2 votes

Using delta time for movement

If we refer to physics 101 (Motion in a Straight Line: Crash Course Physics #1), we will find that linear motion works as follows: ...
Theraot's user avatar
  • 25.1k
2 votes
Accepted

Infinite Loop in AStar (A*) Algorithm

There are a few misunderstandings of A* here. You add every node to the closed set before you add it to the open set, but that's strictly speaking premature: at this point, we know we've found a ...
DMGregory's user avatar
  • 132k
2 votes

Correct way to handle A* no pathing?

Normally, if it is possible for there to be isolated sections of your graph, you would want to have an extra parameter for what "set" each node belongs to. All nodes that are connected in the graph ...
GaleRazorwind's user avatar
2 votes
Accepted

Generate random line path with no intersection

Finding a line-line intersection has a well documented solution, and while the equation might look complicated it is really simple enough to not warrant a library to solve. In python it might look ...
bornander's user avatar
  • 4,461
1 vote

Given a 2D array, how do I generate a random path of fixed length from a random point at length 0 to a random point at max length?

Some pseudo algorithm that can at least give a start. Since start and endpoint can be random, generate them at the start to make sure we can generate a valid path. Find out how many side steps the ...
Zibelas's user avatar
  • 3,363
1 vote

Let a point drive on a polyline

Usually, you would want to look for an API or lib that provides you with sufficiently sophisticated curve rendering and querying, as the underlying math can be quite difficult. However, if you want ...
vek's user avatar
  • 161
1 vote

Calculating projectile path when fired at an angle, forward

Presumably you started by reading our extensive library of existing Q&A on projectile-physics, and constructing a vector from an angle. Putting those together, you should have no difficulty ...
DMGregory's user avatar
  • 132k
1 vote

Correct way to handle A* no pathing?

Having a node limit for your pathfinding is actually a very common thing to have. If a* is not good enough for your game, then there are some more advanced solutions you can try, like hierarchical ...
Philipp's user avatar
  • 118k
1 vote

How to make a more accurate lap time? get_timer() LIMITATION?

Your problem seems to be that you only check whether any cars have passed the finish line in every frame. Since the game has a fixed time-resolution (60Hz) it really can't tell the difference between ...
Bálint's user avatar
  • 14.8k
1 vote
Accepted

How to make a car follow a path?

Thanks everyone for your help. I wanted to say that i achieved the steering behavior of a car by applying what i found in this video(https://www.youtube.com/watch?v=11ofnLOE8pw&t=423s) I edited ...
Seif Karoui's user avatar
1 vote

How to draw the path with a thicker stroke?

This will draw a red diagonal line, 6 pixels wide, from point (100,100) to point (200,200). draw_set_colour(c_red); draw_line_width(100, 100, 200, 200, 6); ...
John's user avatar
  • 111
1 vote

How to make a homing projectile make a more objective path to the target?

This is probably what you need. It's for unity in C# but the maths all there. http://wiki.unity3d.com/index.php/Trajectory_Simulation I use this all the time and it is VERY accurate even at high ...
Daniel Awesome's user avatar
1 vote

How to make a homing projectile make a more objective path to the target?

Intercept the target I'm not too familiar with UE, but the behaviour you describe is consistent with the projectile "naively" accelerating towards the target's current position (from your ...
Ruther Rendommeleigh's user avatar
1 vote

How to make specific paths in UE4?

Since you want to have a nav mesh over the whole level but make the AI only move to the location in the direction and angle you want them to, you need to switch from SimpleMoveTo and AIMoveTo. You'll ...
Stephen's user avatar
  • 1,030
1 vote

Pool game ball path line

The direction (d) in which the target ball should move is AB.normalized, where A is the center of the imaginary circle (where ...
Bizhan's user avatar
  • 169
1 vote

Recognize that user has traced a path of vector points with mouse

Maybe something like the p$ algorithm for gesture recognition would serve your purpose? Just remove the normalizing from the gesture comparison so it cares what size your gesture is. http://depts....
Plastic Sturgeon's user avatar
1 vote

Follow a path in Unity

Take a look at the Navigation components. You can add a NavMeshAgent to a GameObject and control with a script the path he should walk. You can easily do in this script: ...
Artery's user avatar
  • 194
1 vote
Accepted

How to find the optimum path, on a road, for a car?

You're looking for two important properties here. The path must obviously be continuous (can't jump) but also the direction must be continuous (turning around a corner takes time). Since it's a racing ...
MSalters's user avatar
  • 884

Only top scored, non community-wiki answers of a minimum length are eligible