Skip to main content

Collisions & Physics

MD Engine provides a simple collision & physics system; it's not a fully featured physics engine like Box2D, but good enough for arcade-style platformers, shooters, puzzles, etc.

There are several physics values, local to each actor:

  • Position
  • Velocity X / Y
  • Acceleration X / Y

Also, some are global to the entire game:

  • Maximum Velocity X / Y
  • Deceleration X / Y
  • Gravity
  • Jump

You can adjust the global ones on the Global Values settings.

The global acceleration, gravity, and jump values are only used if you enable Platformer Behaviour for an actor.

Collision System

There are three different collision systems available to choose, Simple, Advance (Fast), and Advance (Slow).

The major difference is that on the Advance system, actors can push each other while on the simple they overlap but can't physically move one another.

Actor Overlap Behaviour

When two actors overlap each other you can adjust how the On Collide scripts are invoked, it can be changed on the Collisions settings.

  • First Time - This option makes the On Collide been called only the first time it happens, and it won't be called again until they stop overlapping.
  • Continuous - This option makes the On Collide been called all frames since it happens until there is no overlap.
warning

Be aware First Time option may behave the same as Continuous option if both actors are solid and you are using the Advance system.
Due to actors never fully overlapping, they separate and adjust their positions.

Collision Mode

This is an adjustment that you can enable if you have very large levels and a lot of actors, so only actors that are on-screen are checked for collisions.

Collision Bias

Collision bias refers to a small numerical adjustment (or tolerance) used to prevent actors from "sticking," jittering, or tunneling through each other.

Collision Masking

Collision masking is a technique used in physics simulations to control which actors can collide or interact with each other.

Instead of every actor checking collisions against every other actor (which can be inefficient or undesirable), collision masking lets you define groups that specify which collisions should be considered.

You can assign each actor to a specific group in the actor settings.

After that, you can select if each collision group overlaps another by just clicking the box.

Collision Frequency

You can adjust the frequency each of the collision groups will be checked.