How do I create 'race manager' movement without overlap

0 favourites
  • 5 posts
From the Asset Store
Top Down Racing Game Pixel Artwork for any kind of racing game you can imagine.
  • Hi,

    I am looking to create movement like the popular game 'race manager'. I have used the path finding example so far and played with this to get a good movement for a single car around the track. If I add extra cars when they overlap they pass through each other. I am looking at if its possible to have the cars go around each other like cars would on a real track?

    So far I've tried bullet bounce or custom movement 'push' which I found in a thread but neither seem to work.

    Thanks,

  • Don't think about it in terms of collisions - trying distance measurements instead. If car A is closer than X pixels to car B, attempt to go around it by speeding up/slowing down car A.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi digitalsoapbox

    I was hoping for both cars to keep their existing speed and for the quicker one to move out and overtake it as it passes.

  • Hi digitalsoapbox

    I was hoping for both cars to keep their existing speed and for the quicker one to move out and overtake it as it passes.

    After checking for distance, you could then pick the car with the higher velocity to execute the actions on.

  • I'm not sure there is an easy solution. You could look into steering behaviors as used in boids for a possible solution.

    You could also take digitalsoapbox's idea to detect what's around the car and then use a state machine to decide what the car will do.

    Like if it is clear in front of the car have it accelerate and drive in the best path.

    If a car is in the way, have the car try to steer around the other. If the other car then slows then have the first car stop overtaking and move to the best path.

    Basically look at what's around the car moment by moment and have states like "overtake" for maneuvers that take longer. It can get as complex as you want.

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