/phyz

2D game physics for Zig

Primary LanguageZigMIT LicenseMIT

Phyz

Phyz is a work-in-progress physics engine for 2D games, written in Zig. Goals are simplicity, speed and ease of use, in that order.

Progress

  • GJK algorithm
  • Continuous collision detection
    • Dynamic-Static
    • Dynamic-Dynamic
  • Fully customizable collision resolution
  • Broad phase
  • Queries
    • Nearest object
    • Raycast
    • Objects in shape
  • Handle intersecting colliders
  • Collision masking
  • Temporary collider disable flag
  • Collider deletion
  • More interesting actuators
    • Forcefields/magnetism
    • Constraints
  • General purpose resolver
    • Friction
    • Bounce

Non-goals

To keep the engine simple and fast, a number of things are purposefully not supported:

  • Rotation and angular velocity
  • Soft bodies
  • Non-convex colliders (can be approximated using multiple convex colliders)
  • Multiple colliders per object (can be approximated using constraints)

If you need support for these things, I recommend using a more complex physics engine such as Chipmunk2D or Box2D.