Crates.io | mgf |
lib.rs | mgf |
version | 1.4.0 |
source | src |
created_at | 2017-10-26 03:22:11.514226 |
updated_at | 2020-04-27 18:58:28.301514 |
description | A 3D collision and physics framework for video games. |
homepage | https://github.com/maplant/mgf |
repository | https://github.com/maplant/mgf |
max_upload_size | |
id | 36969 |
size | 246,141 |
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:
Ray
, Segment
, AABB
, Rectangle
, Triangle
, Sphere
, Capsule
Component
, ComponentConstructor
Mesh
, Compound
,Overlaps
, Contains
Intersection
, Contact
, LocalContact
BVH
RigidBodyVec
, ContactConstraint
, Solver
Pool
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.
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 Spheres
and 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.
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
Here is a link to a video of the demo in action.
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 LGPL 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 map@maplant.com
and we can
assign you a custom license free of charge.