How to make collisions between machines?

0 favourites
  • 4 posts
From the Asset Store
Sprite set of animated modern war machines, include ground and air machines.
  • Hello everyone. I’m developing an F1 based game where I have 20 cars running on the track. One of the 20 is represented by the player while the other 19 are all instances of the same object that represents the other machines. So now all these objects have the Car behavior to make the movements. However, I don’t know how to handle collisions. In fact, if I apply solid behavior, machines bounce off with nonreal bounces. If I apply physical behavior, machines overlap and don’t respect collisions. Do you have any idea?

  • The issue is that using the default car behavior comes with it's own collision with a solid object. So even if you did temporarily turn off car and on physics and then transfer the calculated velocity and turn off physics and back on with the car the rotation would still take you manually applying it using variable to keep track of rotational torque. You can't have two collision deciding behaviors on at the same time.

    The fix I chose for this was to ditch the car behavior entirely and use physics behavior only and manually create the car movement. The only thing different than basic movement will be the car movement angle has to catch up to the direction your pointing, which is no big deal, in fact this is the only way to pull a 180 and drive backwards kind of technique as well because the max drift is like 90 degrees with default car behavior meaning it doesn't have a smooth in-motion method of transitioning between forward and backwards movement.

  • The issue is that using the default car behavior comes with it's own collision with a solid object. So even if you did temporarily turn off car and on physics and then transfer the calculated velocity and turn off physics and back on with the car the rotation would still take you manually applying it using variable to keep track of rotational torque. You can't have two collision deciding behaviors on at the same time.

    The fix I chose for this was to ditch the car behavior entirely and use physics behavior only and manually create the car movement. The only thing different than basic movement will be the car movement angle has to catch up to the direction your pointing, which is no big deal, in fact this is the only way to pull a 180 and drive backwards kind of technique as well because the max drift is like 90 degrees with default car behavior meaning it doesn't have a smooth in-motion method of transitioning between forward and backwards movement.

    Thanks for the answer. Not being very good with physical behavior, do you have any suggestions on how to make my top-down machine move and how to make it turn for example in curves?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • First under your start of layout actions make sure global setting: set world gravity action caps the gravity at 0 because we are doing top down.

    The regular driving should be apply force at angle for the angle that the car is facing and you should apply torque towards angle and add or subtract from the car's current angle to get your turn but keep an eye on angular velocity and angular dampening setting and change that when needed. Your steering should have to catch up to your facing angle. This is a pain to get right but also experiment with whether just rotating the object instead of using physics to rotate is better for you.

    A lot of these mechanics are going to be trial and error because the physics behavior isn't the easiest thing to suit to what we are doing here. Lots of things may require a constantly updated variable that you use inside your driving mechanics. Try some experimentation and update me on what part doesn't operate like a car.

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