BEPUphysics
rapier
Our great sponsors
BEPUphysics | rapier | |
---|---|---|
5 | 39 | |
2,158 | 3,545 | |
3.6% | 5.6% | |
8.7 | 8.4 | |
5 days ago | 2 days ago | |
C# | Rust | |
Apache License 2.0 | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
BEPUphysics
-
Current state of 2D game code-first frameworks?
The best pure-C# physics library (hands-down) is bepuphysics2, which unfortunately is mainly a 3D physics library, but could be used for 2D if you wanted to get your hands dirty.
- Physics Engine
-
Open Source C++ Physics Libraries for Dedicated FPS Server?
Bepu Physics is pretty good and is written in really optimized C#, the author's blog post are really interesting to read.
-
GJK: Collision detection algorithm in 2D/3D
The usual approach is some form of sweep to get a time of impact. Once you've got a time of impact, you can either generate contacts, or avoid integrating the involved bodies beyond the time of impact, or do something fancier like adaptively stepping the simulation to ensure no lost time.
If the details don't matter much, it's common to use a simple ray cast from the center at t0 to the center at t1. Works reasonably well for fast moving objects that are at least kinda-sorta rotationally invariant. For two dynamic bodies flying at each other, you can test this "movement ray" of body A against the geometry of body B, and the movement ray of body B against the geometry of body A.
One step up would be to use sphere sweeps. Sphere sweeps tend to be pretty fast; they're often only slightly more complicated than a ray test. Pick a sphere radius such that it mostly fills up the shape and then do the same thing as in the previous ray case.
If you need more detail, you can use a linear sweep. A linear sweep ignores angular velocity but uses the full shape for testing. Notably, you can use a variant of GJK (or MPR, for that matter) for this: http://dtecta.com/papers/jgt04raycast.pdf
If you want to include angular motion, things get trickier. One pretty brute forceish approach is to use conservative advancement based on distance queries. Based on the velocity and shape properties, you can estimate the maximum approaching velocity between two bodies, query the distance between the bodies (using algorithms like GJK or whatever else), and then step forward in time by distance / maximumApproachingVelocity. With appropriately conservative velocity estimates, this guarantees the body will never miss a collision, but it can also cause very high iteration counts in corner cases.
You can move a lot faster if you allow the search to look forward a bit beyond potential impact times, turning it into more of a root finding operation. Something like this: https://box2d.org/files/ErinCatto_ContinuousCollision_GDC201...
I use a combination of speculative contacts and then linear+angular sweeps where needed to avoid ghost collisions. Speculative contacts can handle many forms of high velocity use cases without sweeps- contact generation just has to be able to output reasonable negative depth (separated) contacts. The solver handles the rest. The sweeps use a sorta-kinda rootfinder like the Erin Catto presentation above, backed up by vectorized sampling of distance. A bit more here, though it's mainly written for users of the library: https://github.com/bepu/bepuphysics2/blob/master/Documentati...
-
Early Demo of Dynamic Blocky Lighting System
I use https://github.com/bepu/bepuphysics2. I haven't worked with 3d physics engines before so I can't really comment on it's quality but it is definitely an impressive project! The developer is very active and helpful and some of the demo scenes are pretty large and complex.
rapier
-
Xkcd 2916: Machine
Ok, so this uses https://rapier.rs/ which is very cool
Rapier, alongside https://nalgebra.org/ (which it uses underneath) has seriously good documentation and some advanced features like cross-platform determinism (something made hard by the way floating point differs between platforms)
-
Rust Game Physics Engines: PhysX, Rapier, XPBD & Others
Code examples: see examples2d, examples3d-f64 and examples3d directories
- Rapier: Fast 2D and 3D physics engines written in Rust
-
Bevy XPBD: A physics engine for the Bevy game engine
What are the pros and cons compared to something like Rapier? When should one use Bevy XPBD instead of Rapier, or vice versa?
-
What's everyone working on this week (22/2023)?
Still using Rust in a browser-based multiplayer party game I'm working on! I'm using Actix Web for the backend and rapier2d to handle my game's physics. I'm looking to make some more connections amongst the developer / gaming community through my game down the line.
-
Constructing a piston/muscle/gas strut in bevy_rapier3d?
I have noticed that Rapier 0.17 contains a RopeJoint struct, which constrains maximum distance between two dynamic bodies. It doesn't seem to have found its way into bevy_rapier3d yet so I haven't understood whether it supports (half of) my use case, and looking at the code (https://github.com/dimforge/rapier/blob/master/src/dynamics/joint/rope_joint.rs) I really cannot see how it is actually implemented and how I could extend it to also set a minimum distance, but this may be a place to start.
-
Next part of my platformer in bevy series
I was also frustrated with the kcc, so I opened a PR that fixes most of my issues: https://github.com/dimforge/rapier/pull/446
-
What libraries does Idris need to increase adoption?
Likewise, see the js bindings of Rapier.
-
Good resources for structuring a 2d physics engine in Rust?
Maybe check out how Rapier does it. Rapier is likely the most advanced physics engine in Rust. (Though Embark Studios is doing some crazy stuff with ML physics.)
-
A Rust client library for interacting with Microsoft Airsim https://github.com/Sollimann/airsim-client
rapier
What are some alternatives?
JoltPhysics - A multi core friendly rigid body physics and collision detection library, written in C++, suitable for games and VR applications.
box2d-wasm - Box2D physics engine compiled to WebAssembly. Supports TypeScript and ES modules.
Stride Game Engine - Stride Game Engine (formerly Xenko)
bevy - A refreshingly simple data-driven game engine built in Rust
MonoGame - One framework for creating powerful cross-platform games.
parry - 2D and 3D collision-detection library for Rust.
Xenko
nakama - Distributed server for social and realtime games and apps.
Nez - Nez is a free 2D focused framework that works with MonoGame and FNA
PixiJS - The HTML5 Creation Engine: Create beautiful digital content with the fastest, most flexible 2D WebGL renderer.
osu-framework - A game framework written with osu! in mind.
gdnative - Rust bindings for Godot 3