A 2D collision detection and physics library written in C.
WARNING: This library is in an early alpha stage, use it at your own risk.
Since this project was made to learn how a physics engine works, I am not planning to add a lot of features to it.
- Broad-phase collision detection with spatial hashing algorithm
- Narrow-phase collision detection with SAT (Separating Axis Theorem)
- 'Sequential Impulse' iterative constraint solver
- Semi-implicit (symplectic) Euler integrator
- GCC version 9.4.0+
- GNU Make version 4.1+
- Git version 2.17.1+
$ sudo apt install build-essential git
Make sure you have installed raylib 3.7.0+ to compile all examples.
This project uses GNU Make as the build system.
$ git clone https://github.com/c-krit/ferox $ cd ferox $ make
You can also build this library as standalone-mode to avoid
raylib.h header inclusion and functions that depend on raylib:
$ make BUILD=STANDALONE
Cross-compiling for Windows
Make sure to set the value of
RAYLIB_PATH variable to cross-compile for Windows:
$ make RAYLIB_PATH=../raylib TARGET_OS=WINDOWS
- Agafonkin, Vladimir. (2017, April 27), A dive into spatial search algorithms
- Apple Inc. (2021), SKPhysicsBody | Apple Developer Documentation
- Bostock, Mike. (2018, January 23), Sutherland–Hodgman Clipping
- dyn4j. (2011, November 11), Contact Points Using Clipping
- dyn4j. (2010, January 01), SAT (Separating Axis Theorem)
- Catto, Erin. (2006), Fast and Simple Physics using Sequential Impulses
- Catto, Erin. (2005), Iterative Dynamics with Temporal Coherence
- Coumans, Erwin. (2010, July 26), Collision Detection: Contact Generation and GPU Acceleration
- Hastings, Erin & Mesit, Jaruwan. (2005). Optimization of large-scale, real-time simulations by spatial hashing
- Fiedler, Glenn. (2013, February 24), Collision Response and Coulomb Friction
- Fiedler, Glenn. (2004, June 10), Fix Your Timestep!
- Fiedler, Glenn. (2004, June 01), Integration Basics
- Gaul, Randy. (2013, April 06), How to Create a Custom Physics Engine
- Gaul, Randy. (2013, July 16), Separating Axis Test (SAT) and Support Points in 2D
- Gregorius, Dirk. (2013), The Separating Axis Test between Convex Polyhedra
- Lysenko, Mikola. (2015, January 13), Collision detection (part 3): Benchmarks
- Macdonald, Tristam. (2009, October 01), Spatial Hashing
- Manzke, Michael. (2016, February 22), Multiply Contact Resolution
- NVIDIA Corporation. (2017, May 12), NVIDIA PhysX 3.4.0 API Documentation
- Rees, Gareth. (2019, February 09), How do you detect where two line segments intersect?
- Scratchapixel. (n.d.), A Minimal Ray-Tracer: Rendering Simple Shapes (Sphere, Cube, Disk, Plane, etc.)
- Unity Technologies. (2018, April 04), Unity Manual: Physics Reference 2D
- Virtual Method Studio. (2017, November 21), Physics 101 #3: Solvers