GithubHelp home page GithubHelp logo

ly774508966 / jitterphysics Goto Github PK

View Code? Open in Web Editor NEW

This project forked from notgiven688/jitterphysics

0.0 0.0 0.0 22.02 MB

A cross-platform, realtime physics engine for all .NET apps.

License: MIT License

Batchfile 0.15% C# 99.85%

jitterphysics's Introduction

Jitter Physics

JitterPhysics Build JitterPhysics on NuGet

Jitter Physics is a fast and lightweight 3D physics engine written in C#.

Jitter Physics Cloth Speculative Contacts Jitter Physics
Jitter Physics Cloth Speculative Contacts Jitter Physics

Platforms & Frameworks

  • Every platform which supports .NET, Mono or Xamarin
  • Works with the Mono framework on Linux/Mac without any recompilation
  • Also supports the Xbox360 and Windows Phone (up to v0.1.7)
  • No dependencies. Every 3D engine/framework is supported: OpenTK, SlimDX, SharpDX, XNA, IrrlichtEngine, Urho3D

Overall Design

  • Written in pure C# with a clean and object orientated API
  • Optimized for low to no garbage collections and maximum speed
  • Supported Shapes: TriangleMesh, Terrain, Compound, MinkowskiSum, Box, Sphere, Cylinder, Cone, Capsule, ConvexHull
  • Take advantage of multi-core CPUs by using the internal multithreading of the engine

Jitter Physics (2D)

The "Jitter-2D" branch is still in development an is not complete. At this time, it is probably better to make use of Farseer Physics.

Quick Start

Initialize the Physics System

Create a world class and initialize it with a CollisionSystem:

CollisionSystem collision = new CollisionSystemSAP();
World world = new World(collision);

Add Objects to the World

Create a shape of your choice and pass it to a body:

Shape shape = new BoxShape(1.0f, 2.0f, 3.0f);
RigidBody body = new RigidBody(shape);

It's valid to use the same shape for different bodies. Set the position and orientation of the body by using it's properties. The next step is to add the Body to the world:

world.AddBody(body);

Run the Simulation

Now you can call the Step method to integrate the world one timestep further. This should be done in you main game loop:

while (gameRunning)
{
    world.Step(1.0f / 100.0f, true);
    
    // do other stuff, like drawing
}

The first parameter is the timestep. This value should be as small as possible to get a stable simulation. The second parameter is for whether using internal multithreading or not. That's it the body is now simulated and affected by default gravity specified in World.Gravity. After each timestep the Position of the body should be different.

Credits

This library was originally written by Thorben Linneweber. Original source code can be found at https://code.google.com/archive/p/jitterphysics.

jitterphysics's People

Contributors

mattbettcher avatar mattleibow avatar morus-pro avatar

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.