Kinematic Character example w/ example Jump action



Kinematic Character Controller are useful in a physics world to control things like: Players, NPCs, Moving Platforms, etc.

In this example added a jump function.

From the Rapier 3D JS docs:

"Most games involve bodies behaving in ways that defy the laws of physics: floating platforms, elevators, playable characters, etc. This is why kinematic bodies exist: they offer a total control over the body’s trajectory since they are completely immune to forces or impulses (like gravity, contacts, joints).

But this control comes at a price: it is up to the user to take any obstacle into account by running custom collision-detection operations manually and update the trajectory accordingly. This can be very difficult. Detecting obstacles usually rely on ray-casting or shape-casting, used to adjust the trajectory based on the potential contact normals. Often, multiple ray or shape-casts are needed, and the trajectory adjustment code isn’t straightforward.

The Kinematic Character Controller (which we will abbreviate to character controller) is a higher-level tool that will emit the proper ray-casts and shape-casts to adjust the user-defined trajectory based on obstacles. The well-known move-and-slide operation is the main feature of a character controller."

Read more here about adjusting parameters (above was quoted from this link)

https://rapier.rs/docs/user_guides/javascript/character_controller

Files

RapierKinematicCharacter.c3p 301 kB
Mar 10, 2024

Get Construct 3 3D Physics

Buy Now$10.00 USD or more

Leave a comment

Log in with itch.io to leave a comment.