MGF: Matt's Game Framework
MGF is a collision detection and physics library for use in 3D video games.
MGF is intended to very light weight and uses cgmath as a math backend.
The library provides various features such as:
- structures to define shapes:
- dynamic shape types:
- structures to define aggregate shapes:
- discrete collision detection:
- continuous collision detection:
- a bounding volume hierarchy:
- rigid body physics:
- dynamic containers:
MGF is very much in its infancy and is therefore not feature complete. If you notice any errors or poorly thought out interfaces be sure to let me know.
For the time being MGF is solely designed to handle 3D video games. This reflects my own use of MGF. If there is enough demand for MGF to support 2D games, it may in the future.
Differences between other collision detection/physics libraries
Most collision detection and physics libraries provide similar to functionality
to MGF, what differs is how they are implemented. Most libraries use the GJK
algorithm to perform every type of collision, including continuous ones. MGF focuses
on providing fast and accurate exact collision detection for moving geometries
commonly found in games, such as
Capsules, and does not and cannot
provide fast and accurate moving mesh on mesh collisions.
As of version 1.1, MGF provides a limited form of GJK discrete collision detection, although in its current form it is quite limited.
Things to keep in mind
One interesting result of the implementation is that the direction of the normal of a polygon determines the "side" it is facing, in a similar manner to how back-face culling is performed. This allows us to determine inter-object penetration much more accurately than we would be able to otherwise. The normal force essentially acts as the direction of propulsion for the object during physics resolution.
You can find working examples in the mgf_demo folder. Demos require gfx and gfx_glutin to display visuals. Be sure to build the demos in release mode to get adequate performance:
cargo build --release
MGF is welcome to anyone's contribution, and any part of the interface is open to discussion. Although if you are going to contribute new features please do be sure to include unit tests.
The open source version of MGF is available with the GNU GPL version 3 license.
This license is quite inconvenient for game programming, so if you would like to request
a custom license for your comercial product please contact
email@example.com and we can
assign you a custom license free of charge.