Coder Social home page Coder Social logo

unity-deterministic-physics-1's Introduction

Unity deterministic physics

This is a modified version of Unity DOTS Physics version 0.6.0-preview.3, which supports cross-platform deterministic physics simulation by using soft floats.

Usage

The following packages must be installed:

  • Burst
  • Collections
  • Entities
  • Jobs

You'll need to use the UnityS.Physics and the UnityS.Mathematics namespaces instead of the usual Unity.Physics and Unity.Mathematics.

See Unity Physics manual for documentation.

Notes on determinism

For a deterministic physics simulation:

  • All bodies must be created in the same order every time you create the simulation
  • Bodies must only be modified in a system that is updated in FixedStepSimulationSystemGroup
  • You must not use the result of floating point operations as input for the physics engine
  • Be careful when using hashmaps / hashsets, because iterating over them may be non-deterministic (it depends on the implementation).
  • Check how to use soft floats here.
  • Make sure that your code is also deterministic.

Example

See the ExampleScene scene for an example. After running it, your simulation should look exactly like this:

License

Unity.Physics, Unity.Mathematics, and Unity.Transforms are licensed under the Unity Companion License.

Soft floats is licensed under the MIT License. See https://github.com/Kimbatt/soft-float-starter-pack for more information.

unity-deterministic-physics-1's People

Contributors

jonjon007 avatar kimbatt 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.