• Hey! Guest! The 37th GMC Jam will take place between May 28th, 12:00 UTC and June 1st, 12:00 UTC. Why not join in! Click here to find out more!

Legacy GM Collision between balls with physical effect


In my current project, there are balls that randomly come out of the map (without gravity) and on the way they can collide with 3 different things:
> solid blocks where they hit and deflect.
> breakable blocks, where they destroy and deflect.
> other balls, they hit and deflect each other.

I would like to make sure that when the balls collide, the one with the highest speed would end up acting at the speed and direction of the other.
Example: Two boys play ball and each is kicking one. They kick both in the same direction. One is with speed force 10, the other with force 20. The higher force will logically "push" and change the direction of the other when both collide. But I can't do it in GMS. The Bounce functions I try to use always end up just "reversing the course" after the crash, rather than the actual physics effect.
can you help me?


Is this a physics room? I’m guessing not.

Are the balls restricted to one dimensional movement? You have made it sound like it is.

For elastic collisions (no loss of energy) two objects of identical mass swap velocities along the dimension of the collision.

Your collision code will have to:
1) get the speed and direction of both balls.
2) swap the speed and direction


Look, each ball has its speed and direction set and can even make a collision with physics. However, when they collide, sometimes they just cross another. Already tried to change the mask, precise, rectangular, full image... Nothing of them worked. The collision still causes one ball to lock on the other several times.
What can I do to prevent this from happening? Like a check steps or something...
Last edited: