idanarye / bevy-tnua

A floating character controller for Bevy
https://crates.io/crates/bevy-tnua
Apache License 2.0
214 stars 14 forks source link
bevy-plugin character-controller locomotion rapier2d rapier3d rust xpbd

Build Status Latest Version Rust Documentation Rust Documentation

Tnua - A Character Controller for Bevy.

Tnua ("motion" in Hebrew) is a floating character controller, which means that instead of constantly touching the ground the character floats above it, which makes many aspects of the motion control simpler.

Tnua can use Rapier or Avian (formerly XPBD), and supports both the 2D and 3D versions of both with integration crates:

Note that:

Features

Demos:

The basis and actions in the demos can be tweaked with a GUI. They are initialized to the Default::default() provided in Tnua, with the following exceptions:

Running the Demos Locally

$ cargo run --bin <demo-name> --features <physics-backend>

Where <demo-name> is the name of the demo and <physics-backend> is either rapier2d, rapier3d, avian2d or avian3d. Make sure to match the dimensionality of the backend (2D or 3D) to that of the demo. For example, to run the 3D platformer with Avian, use this:

$ cargo run --bin platformer_3d --features avian3d

Interesting Parts of the Demo Code

(NOTE: the examples are simpler than the demos, so if there is an example that shows something it'll be easier to read that)

Versions

Tnua is broken into different crates that update separately, so this is broken into multiple tables. The version of bevy-tnua-physics-integration-layer must be the same for both the main bevy-tnua crate and the integration crates.

Main

bevy bevy-tnua-physics-integration-layer bevy-tnua
0.14 0.4 0.19
0.13 0.3 0.16-0.18
0.13 0.2 0.15
0.12 0.1 0.13-0.14

Rapier integration

bevy bevy-tnua-physics-integration-layer bevy-tnua-rapier bevy_rapier
0.14 0.4 0.7 0.27
0.13 0.3 0.6 0.26
0.13 0.3 0.4, 0.5 0.25
0.13 0.2 0.3 0.25
0.12 0.1 0.2 0.24
0.12 0.1 0.1 0.23

Avian integration

bevy bevy-tnua-physics-integration-layer bevy-tnua-avian avian
0.14 0.4 0.1 0.1

XPBD integration

Will not receive any more updates since the bevy_xpbd project has been rebranded as "Avian".

bevy bevy-tnua-physics-integration-layer bevy-tnua-xpbd bevy_xpbd
0.14 0.4 0.5 0.5
0.13 0.3 0.3, 0.4 0.4
0.13 0.2 0.2 0.4
0.12 0.1 0.1 0.3

Pre-split

bevy bevy-tnua bevy_rapier
0.12 0.12 0.23
0.11 0.8 - 0.11 0.22
0.10 0.1 - 0.7 0.21

Reference Material

The following were used for coding the math and physics of Tnua:

Alternatives

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.