Car collision physics

So i’ve been working on this game and I can’t figure out how to make these cars collide with each other. Basically I want them to bounce off of each other depending on how fast the other car is going, for example if one car is going faster than the other and they collide, the other car bounces back farther than the faster car.

1 Like

One way is so that if 1 car overlaps the other car, the car that got hit will get the velocity of the other car but in negatives, causing it to go backwards. So basically like this:

Change (car1) vx by ((car2 vx) x -1)

2 Likes

So I tried doing this, and the cars just clip through each other like this.

Screen recording 2026-02-02 12.21.56

Thats because the “move sprite” block sets your velovity each frame, so it ignores the collision setting the velocity. To fix this, make it so you loose control of the car for a brief period of time upon bumping.

Huh, that’s strange, maybe it’s because you’re moving them with the controller? Maybe adding a forever block that says:
if (right/left) button pressed set (car) vx to (the direction you want it to go)
Though that might not work either :confused: