Godlike / Pegasus

Game physics engine (can fly)
MIT License
5 stars 2 forks source link
collision-detection collision-handling physics-engine

Pegasus

Linux Build Status
Windows Build status

About

Pegasus is a cross-platform C++ game physics engine that is written with the data-oriented design in mind with minimum external dependencies (GLM and SPDLog). The aim of this project is to implement a robust, modern and simple to use API for game physics computations. The main motivation to write this engine was curiosity and desire to write physics code that utilizes a modern approach to software development, such as cache friendly code, high parallelization ability (CPU and GPU with CS), robust memory management with model C++ standard versions.

Join discord chat.

Building

Ubuntu:

Tested on Ubuntu 16.04.

  1. Install essential components:
    sudo apt-get install build-essential git cmake gcc g++

  2. Install dependencies:
    sudo apt-get install freeglut3 freeglut3-dev libglew1.5 libglew1.5-dev libglu1-mesa libglu1-mesa-dev libgl1-mesa-glx libgl1-mesa-dev libxtst-dev xvfb libxmu-dev libxi-dev libxinerama-dev

  3. Clone and initialize:
    git clone git@github.com:Godlike/Pegasus.git && cd Pegasus
    git submodule init && git submodule update --init --recursive

  4. Build:
    mkdir build && cd build && cmake .. && make && chmod +x ./output/PegasusPhysics

  5. Run the demo:
    ./output/PegasusPhysics

Windows:

Tested on Windows 10 VS 2017.

  1. Download GitHub Windows client
  2. Clone repository with the application from git@github.com:Godlike/Pegasus.git
  3. Download CMake GUI for Windows
  4. Create a Visual Studio Project using CMake GUI
  5. Open the solution in VS, build it and run PegasusDemo project.

Mac OS:

Tested on Mac OS High Sierra.

  1. Install CMake
  2. Install Git
  3. Clone and initialize:
    git clone git@github.com:Godlike/Pegasus.git && cd Pegasus
    git submodule init && git submodule update --init --recursive
  4. Build:
    mkdir build && cd build && cmake .. && make && chmod +x ./output/PegasusPhysics
  5. Run the demo:
    ./output/PegasusPhysics

Overview

Collision primitives

Plane

Box

Sphere

Collision detection

Collision detection is handled using custom implementations of Jacobi Eigenvalue, Quickhull Convex Hull, Half-Edge Data Structure, CSO, GJK and EPA algorithms.

Collision resolution

Collision resolution is based on the constraint collision model and implemented using such techniques as Sequential Impules, Restitution Slop, and Warm Starting to help improve overall stabity of the system.

Integration

Pegasus provides an API for creation of Dynamic and Static rigid bodies. Creating new simulation is as simple as creation new Scene object, and population of the new Scene could be peformd trought high-level OOP based API or trough low level Functional handle-based API, which provides developer with the flexibily when performas is needed.

Feature list

Done

Collision detector

Collision resolver

Integrator


Planned

Collision detector

Collision resolver

Integrator