Skip to content

A 2D physics engine built in C++ and SFML, based on the 'Coding a 2D Physics Engine in Java' YouTube series.

Notifications You must be signed in to change notification settings

The-H4CKER/physics-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

C++ 2D Physics Engine

Language Library Build

A 2D physics engine built from scratch in C++ and SFML, based on the popular Java tutorial series by Coding Minecraft.

About The Project

This project is a personal learning exercise to re-implement the "Coding a 2D Physics Engine in Java" tutorial series in modern C++. The goal is to gain a deeper understanding of physics simulation, C++ best practices, and project structure using CMake.

[A screenshot of a cool demo will go here later!]

Getting Started

Follow these steps to build and run the project locally.

Prerequisites

  • A C++17 compliant compiler (GCC, Clang, MSVC, etc.)
  • CMake (version 3.16 or higher)

Note: SFML 3 is downloaded automatically by CMake during the configuration step.

Building

  1. Clone the repo
    git clone [https://github.com/The-H4CKER/physics-engine.git](https://github.com/The-H4CKER/physics-engine.git)
    cd physics-engine
  2. Create a build directory
    mkdir build
    cd build
  3. Run CMake to configure the project
    cmake ..
  4. Compile and build the executable
    cmake --build .

The final executable will be located inside the build directory.

Features & Progress

  • Core Primitives & Data Structures (Videos #2-3) — Includes RigidBody, AABB, Circle, and Box classes.
  • Point vs. Shape Collision Detection (Video #4) — Functions to test if a point is inside a shape.
  • Primitive vs. Primitive Collision Detection (Videos #5-7) — Intersection tests for all shape combinations.
  • Physics Simulation & Gravity (Videos #8-9) — Implementation of the PhysicsSystem, forces, and gravity.
  • Impulse-based Collision Resolution (Videos #10-13) — Calculation of collision manifolds and application of impulses.
  • Rotational Physics & Friction (Videos #14-16) — Adding torque, angular velocity, and friction.
  • Constraints & Joints (Videos #17-19) — Connecting bodies with constraints.

Acknowledgements

  • This project would not be possible without the excellent original Java tutorial series by Coding Minecraft on YouTube.

About

A 2D physics engine built in C++ and SFML, based on the 'Coding a 2D Physics Engine in Java' YouTube series.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published