Good afternoon Group!
Here I leave the download link of a simple project.
LIVE DEMO
https://www.viseni.com/character_navigation/
SOURCE CODE DOWNLOAD LINK – UPDATED TO GITHUB
Basically it is to learn how to use a navigation system of an animated character using the keyboard or virtual joysticks with MoveWithCollisions.
The character is designed using AssetForge, for those of you who don’t know it and like the Low Poly world, I definitely recommend this tool.
Later I have cleaned the mesh generated in 3DsMax.
For the Rigging I used AccuRig from Reallusion, also if you do not know it it’s highly recommended and FREE.
https://actorcore.reallusion.com/auto-rig
Once the Rigging is done I’ve exported it in Unity format and I’ve sent it to Mixamo to get some animations.
In this case I use only 4 animations (Idle, Walk, Run, RunBack), but you already know the potential that Mixamo has.
Here are two methods to use the animations:
- Import the Base Mesh and import the animations independently in BabylonJS, after imported assign them to the base mesh skeleton.
- Import the animations in Blender, mix them using Nonlinear Animation and export the model with the different states of animation.
In this case, I’ve used the second method since it is the simplest and did not require reusing the animations on other characters. For example, if you have some models in your project that will use the same animations is recommended to work with the first method because it´s more efficient.
I´ve passed the model exported from Blender in GLB to Babylon Sandbox to check that everything is correct and modify some parameters of the materials.
I like to use the Babylon Sandbox for the materials since it’s totally faithful to the result.
Again I have exported it in GLB format from Sandbox and imported it in
With this online tool I like to optimize the model to the maximum, using MeshOpt compression in Hight I have reduced from 800Kb to 387Kb and it’s super-easy to use.
I share the rest in the code, It´s clear and lightly documented, for those who want to learn how to move a character using MoveWithCollisions.
You´ve a main.js where is the main code and a controller.js to define the player´s movement
We already know that the most accurate method is using physics, but in many cases for certain apps or mini-games this method is more than enough.
Hope you enjoy it and have a nice weekend people!