Open source C++ physics engine library in 3D

ReactPhysics3D
ReactPhysics3D

ReactPhysics3D is an open source C++ physics engine library that can be used in 3D simulations and games.

www.reactphysics3d.com

Build

Drawing

🎯 Features

  • Rigid body dynamics
  • Discrete collision detection
  • Collision shapes (Sphere, Box, Capsule, Convex Mesh, Static Concave Mesh, Height Field)
  • Multiple collision shapes per body
  • Broadphase collision detection (Dynamic AABB tree)
  • Narrowphase collision detection (SAT/GJK)
  • Collision response and friction (Sequential Impulses Solver)
  • Joints (Ball and Socket, Hinge, Slider, Fixed)
  • Collision filtering with categories
  • Ray casting
  • Sleeping technique for inactive bodies
  • Multi-platform (Windows, Linux, Mac OS X)
  • No external libraries (do not use STL containers)
  • Documentation (user manual and Doxygen API)
  • Testbed application with demos
  • Integrated profiler
  • Debugging renderer
  • Logs
  • Unit tests

📖 Documentation

You can find the user manual and the Doxygen API documentation here.

ℹ️ Branches

The "master" branch always contains the last released version of the library and some possible hot fixes. This is the most stable version. On the other side, the "develop" branch is used for development. This branch is frequently updated and can be quite unstable. Therefore, if you want to use the library in your application, it is recommended to checkout the "master" branch.

Questions

If you have any questions about the library and how to use it, you should use Github Discussions to read previous questions and answers or to ask new questions. If you want, you can also share your project there if you are using the ReactPhysics3D library.

⚠️ Issues

If you find any issue with the library, you can report it on the issue tracker here.

👨 Author

The ReactPhysics3D library has been created and is maintained by Daniel Chappuis.

©️ License

The ReactPhysics3D library is released under the open-source ZLib license.

👍 Sponsorship

If you are using this library and want to support its development, you can sponsor it here.

👏 Credits

Thanks a lot to Erin Catto, Dirk Gregorius, Erwin Coumans, Pierre Terdiman and Christer Ericson for their amazing GDC presentations, their physics engines, their books or articles and their contributions on many physics engine forums.

Thanks to all the contributors that have reported issues or have taken the time to send pull requests.

Owner
Daniel Chappuis
M.Sc, Computer Science (EPFL) Senior Software Engineer
Daniel Chappuis
Comments
  • Memory corruption?

    Memory corruption?

    Hi,

    I have enabled assertions recently in our game and hit an assertion, looks like a possible memory corruption to me if assertions are disabled. The assertion is hit at:

    • https://github.com/andreasdr/tdme2/blob/master/ext/reactphysics3d/src/collision/broadphase/DynamicAABBTree.h#L271

    It happens when trying to check if a player can spawn using this logic:

    • https://github.com/andreasdr/tdme2/blob/master/src/tdme/engine/physics/World.cpp#L386

    Any ideas? We had a related bug before but you fixed it.

    Many thanx and

    Best regards Andreas

  • Objects fall through ConcaveMeshShape

    Objects fall through ConcaveMeshShape

    HI,

    sometimes in like 2/8 cases objects fall through ConcaveMeshShape. In my case the bounding volumes are just BoxShapes.

    I have an example video where you can see the issue:

    • https://www.youtube.com/watch?v=hCFecUVEDQs&feature=youtu.be

    I can provide another video if interested.

    Many thanx and

    Best regards Andreas

  • Assertion Fails and Segmentation Faults With Concave Shape

    Assertion Fails and Segmentation Faults With Concave Shape

    Hi, I started using this library yesterday to help with my undergrad dissertation. I've been enjoying the library but getting tons of segmentation faults. I'm on macOS 10.15.7 using XCode.

    tid_307 (1): EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
    

    This was very prevalent with my first implementation of the physics code. I need to test whether bunch of voxels collide with a mesh, so was creating a box shape and collider body for each voxel. This code produced tons of segmentation faults.

    I've since changed the code to use one box shape and collider, and purely move the transform to each voxel. However, with this change I now get an assertion fail:

    assert(contactPoints[i].size() == 0);
    

    This assertion only triggers on the 5th/6th voxel, however, which makes the problem even stranger. However, I assume it just happens that the 5th/6th voxel is actually colliding so there's a difference in the methods. Ie, for the first few voxels, there's no collision so no contact points. But for the 5th or 6th, it's colliding so there are collision points.

    And if I comment out the assertion, I get more segmentation faults from this code.

    mCollidersComponents.mCollisionShapes[i]->computeAABB(aabb, transform * mCollidersComponents.mLocalToBodyTransforms[i]);
    

    To note about the segmentation faults, they've happened in multiple places and it doesn't seem to be one problematic line of code. However, there seems to be a similarity in that it's related to the entity component system / pointers to entities.

    Segmentation Fault Stack Trace

    #0	0x000000015184d383 in reactphysics3d::BroadPhaseSystem::updateCollidersComponents(unsigned int, unsigned int, float) at OpenPL/External/ReactPhysics3D/src/systems/BroadPhaseSystem.cpp:180
    #1	0x000000015184d0fc in reactphysics3d::BroadPhaseSystem::updateCollider(reactphysics3d::Entity, float) at OpenPL/External/ReactPhysics3D/src/systems/BroadPhaseSystem.cpp:122
    #2	0x00000001517b4894 in reactphysics3d::CollisionDetectionSystem::updateCollider(reactphysics3d::Entity, float) at OpenPL/External/ReactPhysics3D/include/reactphysics3d/systems/CollisionDetectionSystem.h:435
    #3	0x00000001517b46de in reactphysics3d::CollisionBody::updateBroadPhaseState(float) const at OpenPL/External/ReactPhysics3D/src/body/CollisionBody.cpp:233
    #4	0x00000001517b543d in reactphysics3d::CollisionBody::setTransform(reactphysics3d::Transform const&) at OpenPL/External/ReactPhysics3D/src/body/CollisionBody.cpp:398
    #5	0x0000000151892065 in PL_SCENE::FillVoxels() at OpenPL/Source/Private/Objects/Private/PL_SCENE.cpp:415
    #6	0x00000001518907b8 in PL_SCENE::Voxelise(PLVector, PLVector, float) at OpenPL/Source/Private/Objects/Private/PL_SCENE.cpp:308
    #7	0x00000001519f7406 in ::PL_Scene_Voxelise(PL_SCENE *, PLVector *, PLVector *, float) at OpenPL/Source/Private/OpenPL.cpp:109
    

    Assertion Stack Trace

    #4	0x0000000156f21aa8 in reactphysics3d::NarrowPhaseInfoBatch::clear() at OpenPL/External/ReactPhysics3D/src/collision/narrowphase/NarrowPhaseInfoBatch.cpp:133
    #5	0x0000000156f2033a in reactphysics3d::NarrowPhaseInfoBatch::~NarrowPhaseInfoBatch() at OpenPL/External/ReactPhysics3D/src/collision/narrowphase/NarrowPhaseInfoBatch.cpp:47
    #6	0x0000000156f20545 in reactphysics3d::NarrowPhaseInfoBatch::~NarrowPhaseInfoBatch() at OpenPL/External/ReactPhysics3D/src/collision/narrowphase/NarrowPhaseInfoBatch.cpp:46
    #7	0x0000000156f87416 in reactphysics3d::NarrowPhaseInput::~NarrowPhaseInput() at OpenPL/External/ReactPhysics3D/include/reactphysics3d/collision/narrowphase/NarrowPhaseInput.h:54
    #8	0x0000000156f86a05 in reactphysics3d::NarrowPhaseInput::~NarrowPhaseInput() at OpenPL/External/ReactPhysics3D/include/reactphysics3d/collision/narrowphase/NarrowPhaseInput.h:54
    #9	0x0000000156f9f7df in reactphysics3d::CollisionDetectionSystem::testOverlap(reactphysics3d::CollisionBody*, reactphysics3d::CollisionBody*) at OpenPL/External/ReactPhysics3D/src/systems/CollisionDetectionSystem.cpp:1478
    #10	0x0000000156f803be in reactphysics3d::PhysicsWorld::testOverlap(reactphysics3d::CollisionBody*, reactphysics3d::CollisionBody*) at OpenPL/External/ReactPhysics3D/src/engine/PhysicsWorld.cpp:303
    #11	0x0000000156fd9068 in PL_SCENE::FillVoxels() at OpenPL/Source/Private/Objects/Private/PL_SCENE.cpp:419
    #12	0x0000000156fd7798 in PL_SCENE::Voxelise(PLVector, PLVector, float) at OpenPL/Source/Private/Objects/Private/PL_SCENE.cpp:308
    #13	0x000000015713e3e6 in ::PL_Scene_Voxelise(PL_SCENE *, PLVector *, PLVector *, float) at OpenPL/Source/Private/OpenPL.cpp:109
    

    My Code The code is slightly stripped down but still contains the core logic.

    // Create box collider at origin. Will get moved later
    CollisionBody* VoxelBody = PhysicsWorld->createCollisionBody(Transform::identity());
    BoxShape* VoxelShape = PhysicsSystem->createBoxShape(Vector3(VoxelHalfSize, VoxelHalfSize, VoxelHalfSize));
    VoxelBody->addCollider(VoxelShape, Transform::identity());
    
    std::unique_ptr<TriangleVertexArray> TriangleArray (new TriangleVertexArray(static_cast<unsigned int>(Mesh.Vertices.cols()),
                                                                         Mesh.Vertices.data(),
                                                                         3 * sizeof(double),
                                                                         static_cast<unsigned int>(Mesh.Indices.cols()),
                                                                         Mesh.Indices.data(),
                                                                         3 * sizeof(int),
                                                                         TriangleVertexArray::VertexDataType::VERTEX_DOUBLE_TYPE,
                                                                         TriangleVertexArray::IndexDataType::INDEX_INTEGER_TYPE));
            
    TriangleMesh* TriangleMesh = PhysicsSystem->createTriangleMesh();
    TriangleMesh->addSubpart(TriangleArray.get());
            
    ConcaveMeshShape* ConcaveMesh = PhysicsSystem->createConcaveMeshShape(TriangleMesh);
            
    CollisionBody* MeshBody = PhysicsWorld->createCollisionBody(Transform::identity());
    MeshBody->addCollider(ConcaveMesh, Transform::identity());
    
    for (int i = 0; i < MeshCells->size(); i++)
    {
        auto& Cell = (*MeshCells.get())[i];
                
        Eigen::Vector3d Pos = Cell->WorldPosition;
        Transform VoxelTransform = Transform::identity();
        VoxelTransform.setPosition(Vector3(Pos.x(), Pos.y(), Pos.z()));
        VoxelBody->setTransform(VoxelTransform);
    
        if (PhysicsWorld->testOverlap(MeshBody, VoxelBody))
        {
            Cell->Absorptivity = 0.75f; // DEBUG. TODO: Fill this with an actual value
        }
    }
    

    I've just done a little more testing and there are no problems if I use a box shape for the mesh body. It seems the concave mesh shape is the problem.

    I understand concave mesh collision is expensive but I was hoping to have a "one size fits all" solution. As time isn't really a concern, I hoped a concave mesh could work for all meshes I throw at it.

    You can view my roughly up to date code at: https://github.com/KarateKidzz/OpenPL

  • RayTracing: Does sometimes only work partially or even not at all

    RayTracing: Does sometimes only work partially or even not at all

    Hi @DanielChappuis

    I have created a isolated test, written in TDME2, that shows random behaviour of RayCasting in RP3D. This test uses no multithreading or something, its just a basic single threaded test.

    See here:

    • https://github.com/andreasdr/tdme2/blob/master/src/tdme/tests/RayTracingTest.cpp

    You can build and start with:

    • make clean && make -j hardware_threads mains
    • ./bin/tdme/tests/RayTracingTest (from main tdme2 folder)

    You can find my raytracing logic here:

    • https://github.com/andreasdr/tdme2/blob/master/src/tdme/engine/physics/World.cpp#L355

    Expected would be that interaction table will be raytraced from bottom to top, but sometimes it only works on the upper OBB part or sometimes even not at all We have similar issues with other shapes, but lets start with this one.

    You can change "player" X, Y rotation with mouse dragging and move with A,W,S,D keys.

    If you have any questions or something please tell me. As this happens randomly I suggest no error in TDME2 but I can check deeper if required.

    Many thanx and best regards Andreas

  • NaN quaternion assert, master

    NaN quaternion assert, master

    Hi Daniel

    I am trying a game scene which works using v0.7.0, but when I swap to the latest master I get the following assert.

    The assert originates from a NaN lenght of the quaternion.

    (gdb) frame 4 #4 0x000000000063f22c in reactphysics3d::Quaternion::getUnit (this=0x1462184) at /src/mathematics/Quaternion.h:266 266 assert (lengthQuaternion > MACHINE_EPSILON); (gdb) info locals lengthQuaternion = -nan(0x400000) PRETTY_FUNCTION = "reactphysics3d::Quaternion reactphysics3d::Quaternion::getUnit() const"

    #5 0x000000000063ce05 in reactphysics3d::DynamicsWorld::updateBodiesState (this=0x993820) at /src/engine/DynamicsWorld.cpp:222 222 bodies[b]->mTransform.setOrientation(mConstrainedOrientations[index].getUnit()); (gdb) info locals index = 2 b = 0 bodies = 0x1427e90 islandIndex = 0

  • ReactPhysics3D simulation quite unstable

    ReactPhysics3D simulation quite unstable

    It doesnt take many in game ticks before my simulation, which is 15 kinetic bodies attached by simple hinge joints and a floor polygon, to "blow up" and go crazy. Are there any settings or easy tweaks to improve the stability of the simulation?

    Thanks.

  • Creating Polyhedron Mesh

    Creating Polyhedron Mesh

    I am trying to create a square pyramid as a polyhedron mesh - 4 outer triangular faces and two base triangular faces.

    I am able to successfully create the polygon vertex array, but I am having problems with the polyhedron creation stage.

    I am following the progression of shape creation as outlined in the user manual.

    I would appreciate help with this! Thanks

  • Creating Linked List - Contact Manifold

    Creating Linked List - Contact Manifold

    Hi, I am trying to create a linked list of all the contact manifold points using your documentation:

    //add contact manifold to the linked list, IF the two shapes overlap (aabb check) rp3d::List<const rp3d::ContactManifold*> manifolds;

    // Get all the contacts of the world manifolds = dynamicsWorld->getContactsList(); rp3d::List<const rp3d::ContactManifold*>::iterator it;

    // For each contact manifold for (it = manifolds.begin(); it != manifolds.end(); ++it) { const rp3d::ContactManifold* manifold = *it;

    but my team and I are running into an error at this piece:

     error: ‘iterator’ is not a member of ‘reactphysics3d::List<const reactphysics3d::ContactManifold*>’

             rp3d::List<const rp3d::ContactManifold*>::iterator it;

    Any help would be great!

  • Question about  solvePositionCorrection

    Question about solvePositionCorrection

    hello, when I test HingeJoint, there are two shapes in the righidbody, and the rigid body connect a static rigid body. the dynamic rigid body rotate around z axis, and anchor point is(-1, 0, 0). it works but the dynamic rigid body's position is wrong, I expect the position is (0,0,0) in original. but the position is (0.5,0,0). it is not the same as the Position in Unity3d.
    So, I do things like below: rp3d::WorldSettings settings; settings.defaultPositionSolverNbIterations = 0; the original(or Init) position is right, but the anchor point has some offset, not I respected.

    All in all , when I export unity physics data, and import the data to my app. the hingeJoint simulate result is not right.

  • Question about  EventListener

    Question about EventListener

    hello!

    1. How Can I implement OnCollisionEnter(), OnCollisionExit(); OnCollisionStay(), OnTriggerEnter(), OnTriggerExit(); OnTriggerStay() as the same with unity3d?
  • ubuntu linux installation doesn't place .h files in correct subfolders

    ubuntu linux installation doesn't place .h files in correct subfolders

    On installing on ubuntu linux 18.04 I get the following install messages

    Install the project... -- Install configuration: "Release" -- Installing: /usr/local/lib/libreactphysics3d.so.0.7.1 -- Installing: /usr/local/lib/libreactphysics3d.so.0.7 -- Installing: /usr/local/lib/libreactphysics3d.so -- Installing: /usr/local/include/reactphysics3d/configuration.h -- Installing: /usr/local/include/reactphysics3d/decimal.h -- Installing: /usr/local/include/reactphysics3d/reactphysics3d.h -- Installing: /usr/local/include/reactphysics3d/Body.h -- Installing: /usr/local/include/reactphysics3d/CollisionBody.h -- Installing: /usr/local/include/reactphysics3d/RigidBody.h -- Installing: /usr/local/include/reactphysics3d/ContactPointInfo.h -- Installing: /usr/local/include/reactphysics3d/ContactManifoldInfo.h -- Installing: /usr/local/include/reactphysics3d/BroadPhaseAlgorithm.h -- Installing: /usr/local/include/reactphysics3d/DynamicAABBTree.h -- Installing: /usr/local/include/reactphysics3d/CollisionDispatch.h -- Installing: /usr/local/include/reactphysics3d/DefaultCollisionDispatch.h -- Installing: /usr/local/include/reactphysics3d/VoronoiSimplex.h -- Installing: /usr/local/include/reactphysics3d/GJKAlgorithm.h -- Installing: /usr/local/include/reactphysics3d/SATAlgorithm.h -- Installing: /usr/local/include/reactphysics3d/NarrowPhaseAlgorithm.h -- Installing: /usr/local/include/reactphysics3d/SphereVsSphereAlgorithm.h -- Installing: /usr/local/include/reactphysics3d/CapsuleVsCapsuleAlgorithm.h -- Installing: /usr/local/include/reactphysics3d/SphereVsCapsuleAlgorithm.h -- Installing: /usr/local/include/reactphysics3d/SphereVsConvexPolyhedronAlgorithm.h -- Installing: /usr/local/include/reactphysics3d/CapsuleVsConvexPolyhedronAlgorithm.h -- Installing: /usr/local/include/reactphysics3d/ConvexPolyhedronVsConvexPolyhedronAlgorithm.h -- Installing: /usr/local/include/reactphysics3d/AABB.h -- Installing: /usr/local/include/reactphysics3d/ConvexShape.h -- Installing: /usr/local/include/reactphysics3d/ConvexPolyhedronShape.h -- Installing: /usr/local/include/reactphysics3d/ConcaveShape.h -- Installing: /usr/local/include/reactphysics3d/BoxShape.h -- Installing: /usr/local/include/reactphysics3d/CapsuleShape.h -- Installing: /usr/local/include/reactphysics3d/CollisionShape.h -- Installing: /usr/local/include/reactphysics3d/ConvexMeshShape.h -- Installing: /usr/local/include/reactphysics3d/SphereShape.h -- Installing: /usr/local/include/reactphysics3d/TriangleShape.h -- Installing: /usr/local/include/reactphysics3d/ConcaveMeshShape.h -- Installing: /usr/local/include/reactphysics3d/HeightFieldShape.h -- Installing: /usr/local/include/reactphysics3d/RaycastInfo.h -- Installing: /usr/local/include/reactphysics3d/ProxyShape.h -- Installing: /usr/local/include/reactphysics3d/TriangleVertexArray.h -- Installing: /usr/local/include/reactphysics3d/PolygonVertexArray.h -- Installing: /usr/local/include/reactphysics3d/TriangleMesh.h -- Installing: /usr/local/include/reactphysics3d/PolyhedronMesh.h -- Installing: /usr/local/include/reactphysics3d/HalfEdgeStructure.h -- Installing: /usr/local/include/reactphysics3d/CollisionDetection.h -- Installing: /usr/local/include/reactphysics3d/NarrowPhaseInfo.h -- Installing: /usr/local/include/reactphysics3d/ContactManifold.h -- Installing: /usr/local/include/reactphysics3d/ContactManifoldSet.h -- Installing: /usr/local/include/reactphysics3d/MiddlePhaseTriangleCallback.h -- Installing: /usr/local/include/reactphysics3d/BallAndSocketJoint.h -- Installing: /usr/local/include/reactphysics3d/ContactPoint.h -- Installing: /usr/local/include/reactphysics3d/FixedJoint.h -- Installing: /usr/local/include/reactphysics3d/HingeJoint.h -- Installing: /usr/local/include/reactphysics3d/Joint.h -- Installing: /usr/local/include/reactphysics3d/SliderJoint.h -- Installing: /usr/local/include/reactphysics3d/CollisionWorld.h -- Installing: /usr/local/include/reactphysics3d/ConstraintSolver.h -- Installing: /usr/local/include/reactphysics3d/ContactSolver.h -- Installing: /usr/local/include/reactphysics3d/DynamicsWorld.h -- Installing: /usr/local/include/reactphysics3d/EventListener.h -- Installing: /usr/local/include/reactphysics3d/Island.h -- Installing: /usr/local/include/reactphysics3d/Material.h -- Installing: /usr/local/include/reactphysics3d/OverlappingPair.h -- Installing: /usr/local/include/reactphysics3d/Timer.h -- Installing: /usr/local/include/reactphysics3d/Timer.cpp -- Installing: /usr/local/include/reactphysics3d/CollisionCallback.h -- Installing: /usr/local/include/reactphysics3d/OverlapCallback.h -- Installing: /usr/local/include/reactphysics3d/mathematics.h -- Installing: /usr/local/include/reactphysics3d/mathematics_functions.h -- Installing: /usr/local/include/reactphysics3d/Matrix2x2.h -- Installing: /usr/local/include/reactphysics3d/Matrix3x3.h -- Installing: /usr/local/include/reactphysics3d/Quaternion.h -- Installing: /usr/local/include/reactphysics3d/Transform.h -- Installing: /usr/local/include/reactphysics3d/Vector2.h -- Installing: /usr/local/include/reactphysics3d/Vector3.h -- Installing: /usr/local/include/reactphysics3d/Ray.h -- Installing: /usr/local/include/reactphysics3d/MemoryAllocator.h -- Installing: /usr/local/include/reactphysics3d/DefaultPoolAllocator.h -- Installing: /usr/local/include/reactphysics3d/DefaultSingleFrameAllocator.h -- Installing: /usr/local/include/reactphysics3d/DefaultAllocator.h -- Installing: /usr/local/include/reactphysics3d/MemoryManager.h -- Installing: /usr/local/include/reactphysics3d/Stack.h -- Installing: /usr/local/include/reactphysics3d/LinkedList.h -- Installing: /usr/local/include/reactphysics3d/List.h -- Installing: /usr/local/include/reactphysics3d/Map.h -- Installing: /usr/local/include/reactphysics3d/Set.h -- Installing: /usr/local/include/reactphysics3d/Pair.h -- Installing: /usr/local/include/reactphysics3d/Profiler.h -- Installing: /usr/local/include/reactphysics3d/Logger.h

    However when linking the library into a project it expects the header files in the subdirectories. For example:

    /usr/local/include/reactphysics3d/configuration.h:36:10: fatal error: containers/Pair.h: No such file or directory #include "containers/Pair.h"

    Thanks!

  • About simulate a fragile object

    About simulate a fragile object

    Hi Daniel,

    I want to simulate a fragile object. if other object hit this object with big Force(or fast Velocity), the fragile object will broke into pieces, otherwise the object is a normal rigid body.

    Currently I have not write any code to test. My basic idea is two parts for fragile object: a normal rigid body and a trigger around it. When the trigger is triggered, calculate the velocity of hitting object, if it bigger than the limit velocity, then play the broke into pieces animation.

    I want to known if my idea is ok. Do you have any advice? Thank you.

  • About supporting players' action

    About supporting players' action

    Hi everyone, I am trying to use this engine in my game project, and I am not sure what is the correct way to support players' input. If anyone have any good advice, please tell me. Thank you.

    In my game, players can control a Role (a Capsule in physic world). A joystick controller are used to control direction, and a button is used to do jump action.

    Move

    I tried 3 solutions, but seems none of them is a good way.

    1. add a force to the player's capsule with input direction.
    auto force = 5.0f;
    role->applyWorldForceAtCenterOfMass(direction * force);
    
    world->update(timeStep);
    

    The problem is that if player input the same direction continually, the capsule's velocity will keep growing and will not stop even player input an empty direction. so I should change other setting to fix it? maybe inertia, I am not sure.

    1. calculate move delta, and set position to role rigidbody
    double playerVelocity = 8.0f
    auto posDelta = direction * timeStep * playerVelocity;
    
    auto trans = role->getTransform();
    trans.setPosition(trans.getPosition() + posDelta);
    role->setTransform(trans);
    
    world->update(timeStep);
    

    The problem is that CollisionDetection not works well. We can see two Rigidbodys are part of overlap to each other, but actually the second object should be pushed off without any overlap. Maybe playerVelocity is so big. I don't know why.

    1. set Velocity
    direction.normalize();
    auto vel = direction * playerVelocity;
    role->setLinearVelocity(vel);
    
    world->update(timeStep);
    

    This way can push other rigidbogy off. But the role not stop immediately when player input empty direction. If user keep input the same direction, the role will keep same velocity and glide into the air.

    Jump

    add force to up direction, I don't know if this ok.

     Vector3 playerJumpForce{0, 500, 0};
    role->applyWorldForceAtCenterOfMass(playerJumpForce);
    
    world->update(timeStep);
    

    Turn around

    Seem as move, I not sure which is the right way.

    1. set origention
    auto trans = role->getTransform();
    trans.setOrientation(Quaternion{x,y,z,w});
    role->setTransform(trans);
    
    world->update(timeStep);
    
    1. apply Torque
    role->applyWorldTorque(Vector3{x,y,z});
    
    world->update(timeStep);
    
    1. set AngularVelocity
    role->setAngularVelocity(Vector3{x,y,z});
    
    world->update(timeStep);
    
  • How to support

    How to support "Rollback" ?

    Hi Daniel,

    In the game simulate area, I want to make the physics world state rollback to 1 second ago(maybe 20 frames).

    My solution is to save a queue of WorldState, which contains a list of all PhysicObjectState. The PhysicObjectState contains Transform \ LinearVelocity \ AngularVelocity. When do rollback, I set the Transform \ LinearVelocity \ AngularVelocity back to corresponding physic object.

    Is these enough? do I need save more info?

  • Can NOT compile using ndk r19 for Android platform

    Can NOT compile using ndk r19 for Android platform

    Hi Daniel

    There is a compile error as below when I try to build branch refactor_shapes_creation using ndk r19 for Android platform.

    Compiler: ndk r19

    /react_physics/include/reactphysics3d/memory/DefaultAllocator.h:67:24: error: use of undeclared identifier
          'aligned_alloc'
                    return std::aligned_alloc(GLOBAL_ALIGNMENT, size);
    
  • `RigidBody::setIsActive` / `RigidBody::setIsSleeping` behaviour

    `RigidBody::setIsActive` / `RigidBody::setIsSleeping` behaviour

    I'm slightly confused with sleeping/active body state concepts in the context of their implementation. e.g. RigidBody::setIsActive should either:

    • Put the body to sleep (via RigidBody::setIsSleeping), then deactivate it
    • Or awake the body, then activate it

    But both the code and the comment in RigidBody::setIsSleeping suggest that "If the body is not active, do nothing (it is sleeping)". That means when we try to activate the body with body->setIsActive(true), the simplified call flow would be as follows:

    1. RigidBody::setIsSleeping(false) (RigidBody.cpp:991 - body is not yet active, so the code returns without awaking it)
    2. CollisionBody::setIsActive(true) (finally activate the body)

    In result, our body has been activated, but not awaken. Is it an intended behaviour or I'm missing something ?

Open Source Cheat for Apex Legends, designed for ease of use. Made to understand reversing of Apex Legends and respawn's modified source engine as well as their Easy Anti Cheat Implementation.
Open Source Cheat for Apex Legends, designed for ease of use. Made to understand reversing of Apex Legends and respawn's modified source engine as well as their Easy Anti Cheat Implementation.

Apex-Legends-SDK Open Source Cheat for Apex Legends, designed for ease of use. Made to understand reversing of Apex Legends and respawn's modified sou

Nov 20, 2022
Improved version of real-time physics engine that couples FEM-based deformables and rigid body dynamics
Improved version of real-time physics engine that couples FEM-based deformables and rigid body dynamics

Enhanced version of coupled FEM and constrained rigid body simulation Description This little playground aimed to test our Conjugate Gradients based M

Apr 11, 2022
2D physics header-only library for videogames developed in C using raylib library.
2D physics header-only library for videogames developed in C using raylib library.

Physac Physac is a small 2D physics engine written in pure C. The engine uses a fixed time-step thread loop to simluate physics. A physics step contai

Nov 23, 2022
FireDog - Open source cross-platform lightweight virus signature detection engine.

FireDog 开源跨平台轻量级病毒特征检测引擎。Open source cross-platform lightweight virus signature detection engine. 语言 Language C++ 11 LICENSE 是你们喜欢的:MIT License. 让我们搞起

Nov 4, 2022
Open source simulator for autonomous vehicles built on Unreal Engine / Unity, from Microsoft AI & Research
Open source simulator for autonomous vehicles built on Unreal Engine / Unity, from Microsoft AI & Research

Welcome to AirSim AirSim is a simulator for drones, cars and more, built on Unreal Engine (we now also have an experimental Unity release). It is open

Nov 25, 2022
Open-source and open-hardware scientific RPN calculator
Open-source and open-hardware scientific RPN calculator

OpenRPNCalc Open-source and open-hardware scientific RPN calculator Introduction OpenRPNCalc is a scientific calculator based on STM32 microcontroller

Nov 10, 2022
A fully-functional open source and open hardware mechanical USB computer keyboard with only three keys!
A fully-functional open source and open hardware mechanical USB computer keyboard with only three keys!

threeboard threeboard is a fully-functional open source and open hardware mechanical USB computer keyboard with only three keys. It supports multiple

Nov 15, 2022
Sourcetrail - free and open-source interactive source explorer
Sourcetrail - free and open-source interactive source explorer

Sourcetrail Important Note: This project was archived by the original autors and maintainers of Sourcetrail by the end of 2021. If you want to know mo

Nov 15, 2022
Single source file ASTC texture decompression in C++ (derived from Google's open source Android project)

astc_dec astc_dec is a single source file ASTC texture decompressor with the Apache 2.0 license, derived from Google's open source Android sources. Th

Oct 22, 2022
Integrate the ZENO node system into Blender for creating robust physics animations!

ZenoBlend Integrate the ZENO node system into Blender for creating robust physics animations! End-user Installation Goto Release page, and click Asset

Oct 28, 2022
Basic physics simulation of a chain

Basic Chain Simulation Compile using for example $ g++ ChainElement.cpp ChainLink.cpp Chain.cpp Simulation.cpp main.cpp -std=c++11 -o run -O3 The outp

Oct 17, 2022
This repository consists an implementation of the Algorithms encountered in Computer Science, Physics and Mathematics.
This repository consists an implementation of the Algorithms encountered in Computer Science, Physics and Mathematics.

All the Algorithms you'll ever need xD This repository contains all the algorithms we have encountered in the fields of Computer Science, Mathematics

Oct 4, 2022
This is a helper library to abstract away interfacing with floppy disk drives in a cross-platform and open source library.
This is a helper library to abstract away interfacing with floppy disk drives in a cross-platform and open source library.

Adafruit Floppy This is a helper library to abstract away interfacing with floppy disk drives in a cross-platform and open source library. Adafruit Fl

Nov 14, 2022
First open source android modding library for Geometry Dash Based on Hooking-and-Patching-android-template

Android-ML First open source android modding library for Geometry Dash Based on Hooking-and-Patching-android-template Installation Download this githu

Jul 17, 2022
PRINT++ is a simple, open source print library for C++, the main usage of PRINT++ is printing out "log" messages
PRINT++ is a simple, open source print library for C++, the main usage of PRINT++ is printing out

note that for now, print++ is using std::cout. In future it will be using own print function. Windows version can be unstable That library is in alpha

Jan 23, 2022
Love 6's Regular Expression Engine. Support Concat/Select/Closure Basic function. Hope u can enjoy this tiny engine :)
Love 6's Regular Expression Engine. Support Concat/Select/Closure Basic function. Hope u can enjoy this tiny engine :)

Regex_Engine Love 6's Blog Website: https://love6.blog.csdn.net/ Love 6's Regular Expression Engine Hope u can love my tiny regex engine :) maybe a fe

May 24, 2022
Sword Engine is a fork of Psych Engine that plans on adding more features and quality of life improvements.
Sword Engine is a fork of Psych Engine that plans on adding more features and quality of life improvements.

⚠️ WARNING: This README is currently incomplete, This warning will be removed once it's complete. Friday Night Funkin' - Sword Engine Sword Engine is

Jul 9, 2022
Two Tribes Engine; the engine which we used to create Toki Tori 2+ and RIVE with

Two Tribes Engine We, Two Tribes, have used this engine for over a decade. It started with early development on the Nintendo DS and ultimately resulte

Oct 21, 2022
OpenGL Template Engine - a C++ OpenGL graphics engine which aimed to be a simple startup template for 3D OpenGL projects.
OpenGL Template Engine - a C++ OpenGL graphics engine which aimed to be a simple startup template for 3D OpenGL projects.

OpenGL Template Engine is a C++ OpenGL graphics engine which aimed to be a simple startup template for 3D OpenGL projects. This is the template I personally use for my own projects and provides me with the general OpenGL 3D render setup with model import and UI.

May 16, 2022