0 Favourites

Pathfinding dest. respecting street hand - traffic rules

  • Hi folks; how are you? I got i huge dobt that is consuming for at least one year.

    First; i made a (T ) street surrounded by walls; which is solid. Each hand of the street has its angles place accordly to its direction. For example; the left hand; has its angle set to south; and the right hand has its angle to south; so it would make possible to the car follow a path without invading the wrong way. I placed a car on right side of this T street. It must go to a second vehicle that is on botton of the T street. It does it very well; but the car ignores the right hand and just invafe the wrong way to reach its objective. How can i do to fix it? Thanks! Then ill post some prints of what im saying if you like.

  • Here is one way:

    Make an invisible tilemap (green area) as on this picture:

    https://postimages.org/

    Tilemap should not be solid.

    For Car in pathfinding properties set Obstacles:Custom and in evens add that green tilemap as an obstacle.

    But if you have lots of cars moving in different directions, this trick will not work.

    You might need to use some other method instead of pathfinding.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Here is one way:

    Make an invisible tilemap (green area) as on this picture:

    https://postimages.org/

    Tilemap should not be solid.

    For Car in pathfinding properties set Obstacles:Custom and in evens add that green tilemap as an obstacle.

    But if you have lots of cars moving in different directions, this trick will not work.

    You might need to use some other method instead of pathfinding.

    Hi man and thanks for the help. It's a great idea! But as you said, that's the true, i want to create a AI traffic system just like GTA1 Top down. I never fund a post that talks exactly about that. I found some .capx, but they didn't helped much. i thought for once i could build up a traffic system using pathfinding, but as i tried in many ways before, it won't be possible for various cars, right? Thanks anyway.

  • Well, you can probably define 4 tilemaps like that on each intersection (for cars coming from each of 4 directions).

    When a car approaches the intersection, check which of the tilemaps it is not overlapping and use this tilemap for pathfinding for this car.

  • Check this demo:

    https://www.dropbox.com/s/onbdpqo7pfpvf ... .capx?dl=0

    Left-click a car, then right-click the spot where it should drive.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)