• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Physics Engine: how to prevent pushed objects from overlapping?

inertias

Member
Hello everyone, when using GM's built in physics engine, I noticed that when objects are against a wall and pushed, they will slide through each other.

I attached a gif of what I'm referring to.

Is there no way to prevent this or is it as simple as changing a setting that I'm not aware of?

Thanks!
 

Attachments

rytan451

Member
This is an artefact of how the physics system works. When two objects overlap, it applies a small force to both to separate them. If you apply enough force, you can overcome this separation force. The same thing happens in real life, leading to phenomena such as nuclear fusion. If you want to prevent this, I recommend reducing the mass of the white moving object, while increasing the mass of the brown moving objects. Also reduce the amount of force/impulse you're applying to the white moving object, proportional to its mass decrease.
 
Top