FZX-lib is a header-only, open source C++ physics engine library for 3D simulations and games.
- Rigid body dynamics
- Discrete collision detection (broadphase & narrowphase)
- Collision shapes: Sphere, Box, Capsule, Convex Mesh, Concave Mesh, Height Field
- Collision response & friction with Sequential Impulses solver
- Joints: Ball-and-Socket, Hinge, Slider, Fixed
- Ray casting & collision filtering
- Automatic sleeping for inactive bodies
- No external dependencies (header-only, no STL containers)
- Cross-platform: Windows, Linux, macOS
- CMake ≥ 3.10
- A C++17–compliant compiler
Add the following to your top-level CMakeLists.txt:
include(FetchContent)
FetchContent_Declare(
fzx
GIT_REPOSITORY https://github.com/FahdSeddik/FZX-lib.git
GIT_TAG main
)
FetchContent_MakeAvailable(fzx)Then link against the FZX::fzx target:
add_executable(MyApp src/main.cpp)
target_link_libraries(MyApp PRIVATE FZX::fzx)If you’ve installed FZX-lib system-wide (e.g. via cmake --install), simply:
find_package(FZX REQUIRED)
add_executable(MyApp src/main.cpp)
target_link_libraries(MyApp PRIVATE FZX::fzx)Include the main header in your code:
// src/main.cpp
#include <fzx/fzx.h>
#include <iostream>
int main() {
// Create sim world with default configuration
fzx::SimManager simManager;
auto world = simManager.createSimWorld();
// Create a dynamic sphere body
fzx::Transform transform(fzx::Vec3(0, 10, 0), fzx::Quaternion::identity());
auto body = world->createRigidBody(transform);
// UNDER-CONSTRUCTION //
// IN DEVELOPMENT //
return 0;
}This project is licensed under the zlib License.
This project is inspired by the great work of ReactPhysics3D. I'm creating this repo as part of learning.
