Crates.io | bevy-tnua-xpbd2d |
lib.rs | bevy-tnua-xpbd2d |
version | 0.5.0 |
source | src |
created_at | 2023-11-13 17:57:42.850811 |
updated_at | 2024-07-05 00:58:47.668107 |
description | XPBD 2D integration for bevy-tnua |
homepage | |
repository | https://github.com/idanarye/bevy-tnua |
max_upload_size | |
id | 1033874 |
size | 23,751 |
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 XPBD, and supports both the 2D and 3D versions of both with integration crates:
Note that:
bevy-tnua-<physics-backend>
) and the main bevy-tnua
crate are required, and that the main plugin from both crates should be added.f64
flag), you need to add the f64
flag to all the Tnua crates. This applies to double precision data that gets defined by the physics backend - Bevy itself will still use single precision, and this is the precision the position and rotation will use.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:
TnuaBuiltinWalk::desired_velocity
defaults to the zero vector, but when the user walks the character it is set to a vector of length 20.0 (40.0 in the 2D demo)TnuaBuiltinWalk::float_height
is set to 2.0 even though it defaults to 0.0. User code should always set the float height based on the model's geometrics.TnuaBuiltinWalk::max_slope
is set to $\frac{\pi}{4}$ even though it defaults to $\frac{\pi}{2}$ (which disables the slipping behavior, since this is the slope angle of a wall)TnuaBuiltinJump::height
is set to 4.0 even though it defaults to 0.0. User code should always set the jump height based on the game's requirements (a jump action of zero height is useless)TnuaBuiltinCrouch::float_offset
is set to -0.9 even though it defaults to 0.0. Just like float_height
, this value should always be set by user code based on the model's geometric.TnuaBuiltinDash::displacement
defaults to 0.0, but when the user inputs the command to dash it gets set to a vector of length 10.0.$ cargo run --bin <demo-name> --features <physics-backend>
Where <demo-name>
is the name of the demo and <physics-backend>
is either rapier2d
, rapier3d
, xpbd2d
or xpbd3d
. 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 XPBD, use this:
$ cargo run --bin platformer_3d --features xpbd3d
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.
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 |
bevy | bevy-tnua-physics-integration-layer | bevy-tnua-rapier | bevy_rapier |
---|---|---|---|
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 |
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 |
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 |
The following were used for coding the math and physics of Tnua:
Licensed under either of
at your option.
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.