Adds rotation/movement restrictions, with new functions RigidBody::setLinearVelocityFactor()
and RigidBody::setAngularVelocityFactor()
as inspired by this issue and this issue on the original repo.
This feature/behavior is untested, but its solved some problems for me in my own projects, particularly with RigidBodies falling through Heightmap collision shapes.
After further playing around with the effects, I have the following conclusions.
- Locking all angular velocity (
setAngularVelocityFactor(rp3d::Vector3::zero());
) works great. - Locking any combination of linear velocity works very well -
setAngularVelocityFactor(rp3d::Vector3(1,1,0));
for instance, makes bodies behave like they're locked on rails. - Locking the 'pitch' xor 'roll' axes of angular velocity leads to weird problems. It will lock rotation about one axis, but the axis is static, so things just rotate in a way that looks stupid.
The patchfile of the changes is also available here for your convenience. The remainder of this README is unchanged.
ReactPhysics3D is an open source C++ physics engine library that can be used in 3D simulations and games.
Website : https://www.reactphysics3d.com
Author : Daniel Chappuis
ReactPhysics3D has the following 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
- Logs
- Unit tests
The ReactPhysics3D library is released under the open-source ZLib license.
You can find the user manual and the Doxygen API documentation here
The "master" branch always contains the last released version of the library and some possible bug 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.
If you find any issue with the library, you can report it on the issue tracker here.
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.