Crate mgf [] [src]

A low-level 3D collision and physics library intended for use in 3D video game development.

Collision detection overview

An object implements collision detection routines through the various traits provided by MGF. Each trait provides a disparate form of collision detection:

  • Overlaps: Specifies a collision where the only information required is whether or not two objects overlap.
  • Contains: Specifies a collision where one object completely contains another. For bounding volumes.
  • Intersection: For linear geometries, describes a collision at some time during the motion of a particle (represented with a Ray or Segment) with only one point of contact.
  • Contacts: For moving volumetric geometries, describes a collision with possibly multiple contacts occuring at some time during the motion of the geometries.
  • LocalContacts: Similar to Contacts, but returns contacts with local contact points as well as globals.

Reexports

pub extern crate cgmath;

Modules

bitset

Structs

AABB

An Axis Aligned Bounding Box.

BVH

A Bounding Volume Hierarchy.

Capsule

A sphere swept along a line.

Compound

An aggregate structure of Spheres and Capsules. Has a position and rotation.

Contact

A point of contact between two objects occuring during a timestep.

DefaultPhysConfig

The suggested set of parameters to use when resolving collisions.

Intersection

A collision between a non-volumetric object and a volumetric object.

LocalContact

A point of contact between two objects that includes the contact points for each object in terms of the object's center.

Manifold

Structure for pruning unnecessary contact points.

Mesh

A triangle mesh is a set of triangles that forms some sort of mesh. There are no requirements on the convexivity of the mesh.

Moving

A geometry swept accross a given path of motion.

PhysicsState

A description of the physical state of an object.

Plane

A normal vector and a distance.

Pool

Growable array type that allows items to be removed and inserted without changing the indices of other entries.

Ray

A point and a direction with infinite distance.

Rectangle

A center point, two direction, and two half widths.

RigidBody

A eneric physical body that has a mass, a volume, and experiences linear and rotational movement.

Segment

A point and a direction with a finite distance.

Sphere

A point and a distance.

StaticBody

A physical object that cannot move.

Triangle

Three points in space.

Vertex

A point and a normal

Enums

Component

A component is a generic volume that can either be a Sphere or Capsule at runtime. Anything that can collide with a Sphere and a Capsule can collide with a component.

PoolEntry

Internal storage type used by Pool.

Constants

COLLISION_EPSILON

Maximum tolerence for error, i.e. what we consider the x86 floating point epsilon.

PERSISTENT_THRESHOLD_SQ

Minimum distance between two points required to not reject a point.

Traits

Bound

A type that can overlap, contain, and be combined with one another.

BoundedBy

A type that can be decomposed into a bound.

Contacts

A type that can produce a point of contact with another.

Contains

A type that can completely subsume another.

Delta

An object with a positional derivative over a timestep

Inertia

An type that has a moment of inertia.

Intersects

A type that can collide with a volumetric object and produce a single point of contact.

LocalContacts

A type that produce a point of contact with another and convert it to local coordinates.

MinDistance

Finds the result corresponding to the minimum distance between two objects.

Overlaps

A type that can overlap another.

PhysicsConfig

A set of constants necessary when performing collision resolution.

PhysicsObject

A type that exhibits physical properties.

Polygon

A type that is composed of vertices, edges and has a face.

Shape

A type that describes a set of points in space.

Type Definitions

Rect