GithubHelp home page GithubHelp logo

kywinston / bevy-tnua Goto Github PK

View Code? Open in Web Editor NEW

This project forked from idanarye/bevy-tnua

0.0 0.0 0.0 998 KB

A floating character controller for Bevy

Home Page: https://crates.io/crates/bevy-tnua

License: Apache License 2.0

Rust 100.00%

bevy-tnua's Introduction

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 XPBD, and supports both the 2D and 3D versions of both with integration crates:

Note that both integration crate (bevy-tnua-<physics-backend>) and the main bevy-tnua crate are required, and that the main plugin from both crates should be added.

Features

  • Supports both 2D and 3D versions of Rapier and XPBD
  • Running
  • Jumping
  • Crouching
  • Variable height jumping
  • Coyote time
  • Jump buffer
  • Running up/down slopes/stairs
  • Tilt correction
  • Moving platforms
  • Rotating platforms
  • Animation helpers (not the animation itself, but Tnua has facilities that help deciding which animation to play)
  • Jump/fall through platforms
  • Air actions

Demos:

Demo Rapier XPBD
2D Platformer https://idanarye.github.io/bevy-tnua/demos/platformer_2d-rapier https://idanarye.github.io/bevy-tnua/demos/platformer_2d-xpbd
3D Platformer https://idanarye.github.io/bevy-tnua/demos/platformer_3d-rapier https://idanarye.github.io/bevy-tnua/demos/platformer_3d-xpbd

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, 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

Interesting Parts of the Demo Code

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.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.13 0.2 0.3 0.25
0.12 0.1 0.2 0.24
0.12 0.1 0.1 0.23

XPBD integration

bevy bevy-tnua-physics-integration-layer bevy-tnua-xpbd bevy_xpbd
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

  • bevy_mod_wanderlust - the original inspiration for this mod, and where I got the floating capsule video from. I ended up creating my own plugin because bevy_mod_wanderlust does not support 2D.
  • Rapier itself has a character controller. It's not a floating character controller, but it's integrated with the physics engine itself and uses that privilege to work out some of the problems the floating model is used to address.

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.

bevy-tnua's People

Contributors

idanarye avatar microwonk avatar rparrett avatar timjentzsch avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.