Code Monkey home page Code Monkey logo

cphysics's Introduction

CPhysics

CPhysics is a 2D physics engine written in C++ with the intention of being used in games. It it built with no third-party-library dependencies other than various standard c header files such as cmath.

The testbuild involves Dear imgui, cereal, glfw and glad dependencies for testing purposes.

Screenshots

a relative link a relative link a relative link

Feature List

Physics

  • Rigid body dynamics
  • Primitive joint constraints
  • Momentum
  • Friction
  • Restitution
  • Collision response (Sequential Impulses Solver)
  • Stable object stacking
  • Orbits
  • Explosions
  • Object slicing

Collision

  • AABB queries (Broadphase)
  • One-shot contact manifolds
  • Discrete collision detection
  • Convex polygon and circle collisions
  • Ray casting
  • Position resolution handling

Explosion types

  • Proximity
  • Ray casting
  • Particle

Testbed

  • OpenGL for demo graphics
  • Dear imgui for GUI
  • CppUnitTestFramework for unit tests
  • cereal for serialization of settings

Future features to implement

  • Multi body shapes
    • collisions optimizations for said shapes
  • Demos illustrating limitations within the engine
  • Dynamic tree broadphase
  • Continuous collision detection
  • Island solution and sleep management
  • Extra types of joints (eg Revolute, pulley)
  • Fluid and soft body simulation

Running testbed demo

  • Clone/download the project onto your computer.
  • Open visual studio.
  • Click open local folder and navigate to the folder named "Rebuild of cphysics" that you cloned/downloaded in step 1
  • Select this folder and open it in visual studio.
  • Double click on Rebuild of cphysics.sln
  • Select the debug options "release" and "x86". Run the program.

Documentation

TO DO

Future plans for the project

At the moment, I am focusing on other projects however I will be coming back to this at a later date to add improvements.

License

CPhysics is developed by Hayden Marshall and falls under the MIT license. See LICENSE.txt for more information.

Credits

Dirk Gregorius and Erin Catto's online resources have proven instrumental in learning how to approach and construct a physics engine. Their gdc talks, documentation and numerous physics engine forum posts have been of great use and would highly recommend looking them up for anyone interested in learning about physics engines.

cphysics's People

Contributors

haydenmarshalla avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

aismann dualword

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.