Skip to content

Physics sandbox, based on Newton Game Dynamixs, and OpenGL

Notifications You must be signed in to change notification settings

smarchevsky/physics-sandbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

physics-sandbox

Physics sandbox, based on Newton Game Dynamics, EntityX and OpenGL

How does it work? Using Entity Component System (based on EntityX) you can create “entities” with components “Transform”, “PhysBody”, “Model”, which are responsible for:

  • Transform (position and orientation of the object in space);
  • The physical model based on the physics engine NewtonGameDynamics;
  • A visual model, which consists of mesh and material (shader with color);

What you can do there? Create physical objects. By default, gravity 9.81 m/s2 acts on all physical objects. An object with zero mass is interpreted as static. Make a static surface (Earth), put a ball on it, apply force to it (PhysBody :: applyForce) - the ball will roll on the surface ❤️ You can explode balls like this https://www.youtube.com/watch?v=JwVJS8qGg00 . There are no input manager, it responds only to Esc - exit and F - switching fullscreen/windowed mode.

In general about classes:

  • Transform - 4x4 matrix wrapper, identity by default. Controlled by the PhysBody component, if it exists in this entity.
  • Mesh - 3D object stored on the GPU;
  • MeshData - a class that generates arrays for the mesh, right now it generates a ball, an icosahedron, soon it will be possible to import .obj meshes;
  • Window - window;
  • Model - a visual model that includes a 3D model and material.
  • Material - the material of Model.
  • Shader - compiler and switcher of shaders.
  • ShaderManager - singleton, that compiles all shaders.
  • Camera - the camera, it stores the View and Projection matrix.
  • PhysBody - physical body, wrapper on Newton Game Dynamics.
  • Game - a class with game logic.

Linked libraries from Ubuntu PPA: GLM - vector math; GLEW - OpenGL wrapper; GLFW - window ad input; STL library.

Additional libraries:

Feel free to use it and contact me.

About

Physics sandbox, based on Newton Game Dynamixs, and OpenGL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published