BJS Character Controller V2

Hi everyone,

I’d like to share an experimental third-person character controller I’ve been developing.

I’ve worked on several locomotion and character controller demos over the years, and this V2 is the most refined version so far.

The main focus has been achieving fluid and responsive movement with strong reactivity between player input, physical motion, and animation blending.

Technically, it’s an advanced kinematic character controller, closer in philosophy to Unity’s CharacterController, Unreal’s Character Movement Component, or Godot’s Kinematic Character Controller than to a rigidbody-based solution.

The controller uses a capsule collider, raycast-based ground detection, manual gravity and acceleration, collision handling through Babylon’s moveWithCollisions(), and a locomotion state machine. On top of that, it incorporates ground snapping, stair handling, visual suspension, procedural leaning, squash & stretch, contextual particles, dynamic camera effects, and configurable air control.

The goal is not realistic physics simulation, but rather responsive and believable third-person movement that works consistently and fluid across desktop and mobile devices.

Demo:
https://viseni.com/_demos_/bjs_character_controller_v2/

GitHub:
https://github.com/crazyramirez/BJS_Character_Controller_V2

Feedback, suggestions, and technical discussions are very welcome. :rocket:

9 Likes

It’s great. An improvement will be to make the camera not move back so gradually but remains at a distance as defined with the mouse wheel.
Currently, when you are walking or running, the camera is moving further and further away.

But otherwise it’s really good work.

1 Like

Nice improvement. Added DYNAMIC_FOV and DYNAMIC_FOV_MAX.

Now you can enable or disable them and set the value.

I’ve also added Lock Camera Follow (Real Third Person camera) and a function to calculate the normal movement when walking on ramps and some improvements for smoother, more fluid animations.

2 Likes

It looks better, the camera has a locked distance, but you can no longer rotate the character to the right or left with the mouse when the lock is activated. The distance is well locked, but also locks the lateral movement of the character with the mouse. You are therefore forced to rotate the character on the keyboard, which is more difficult.

1 Like

@Dad72 Amazing idea!
Done and Updated.
With this combination, you can now generate different types of Third Person controls.

1 Like

Yes, that’s good. You have created an excellent character controller.
It’s possible that I’ll try to integrate it into my editor. I just have to try to understand everything.

Do you plan to make a documentation for its uses step by step. Like, how to initialize, how to add animations, public functions that we can use. A kind of tutorial for integrating into our own projects

In any case, I really like your CharacterControler. It seems complete and well made.

1 Like

Thank you very much.

The most basic documentation is available on GitHub in the Readme.

Implementation is simple; check the app.js file and you’ll see a loadCharacter() function.

Simply copy that function to your code, the character-controller.js file. Assign the character:
charRes = await BABYLON.SceneLoader.ImportMeshAsync('', 'assets/', 'character_animated.glb', scene);
And it should work.

I initially tested it with Mixamo models and animations from a free library Quaternius • Universal Animation Library

For this, I used the merge_animations.js file, which allows you to merge your character and animations into a single file:
charPath = charPath || '../assets/character.glb';
animPath = animPath || '../assets/animations.glb';
outputPath = outputPath || ‘../assets/character_animated.glb’;

Also, if you’re going to use your own animations, you’ll need to assign them in character-controller.js and verify that you have all the necessary animations. If not, you’ll need to adapt the code to your requirements.

Progress update:

I’ve added several new locomotion and camera options to the controller:

  • Double Jump

  • Adjustable Air Control

  • Camera Pitch Lock

  • Vertical-Only Mobile Joystick

  • Camera Follow Pitch

  • Additional movement, animation, and camera tuning parameters

  • Mobile controls have been refined and are now fully functional.

The controller is gradually evolving into a fully configurable kinematic locomotion framework, allowing different movement styles and gameplay behaviors through configuration rather than code changes.

Feedback is always welcome.

I’m reposting the access points for anyone interested:

GITHUB

LIVE DEMO

1 Like