Character control

Hello , guys.
Finally I have my character with the idle and running animations , ready to navigate the created path as image bellow:

Now I need to create the controllers to make him run using wasd keys.
So question is:
Is there any recomendation to acomplish this ?
Otherwise , im thinking to look at following project with seems fairly recent.
recomended project

thanks !!!

You also have this, if you don’t want to use physics and is what I use and works perfectly well.

ssatguru / BabylonJS-CharacterController: Un CharacterController pour BabylonJS

1 Like

Thanks @Dad72 , just let me ask you something:
What do you mean with “if you dont want to use physics” ? … can you create something without phyisics ? without physics my character can not stand on any surface … it inmediatelly falls until disapear from scene. Please provide some light to me regarding physics and character control.
In my case after trying to implement this example:
character control for oficial documentation
It works properly without physics …but I need my character to be able to walk on those platforms surfaces.
I can not create a PG to share but will try to share my repo instead.
Regards.

Babylon has a built-in function which is moveWithCollisions()

This function therefore manages the movement of the character with collisions. Without using the physic.

avatar.moveWithCollisions(moveVector);

Maybe you could see this tutorial that uses this function.

https://doc.babylonjs.com/guidedLearning/createAGame/characterMovePt1

Good Idea , I will !!!

1 Like

Here is one of the simplest examples of the first person camera with collisions - https://playground.babylonjs.com/#0VHCTL#32

1 Like

@labris …Great … it is amazing what it does with just a few lines, however I would like to add live to a third person character … Im steal learning but in a near future I would like make him run , jump , kick punch something, fall from some platform, and so …in the most realistic possible way, that is why I was so interested on physics engine.
Any way … it is a step by step path , I have a lot to lear from BBjs.

Yo @Leandro_Roggerone

Havok physics is WAY MORE ACCURATE than moveWithCollision, especially when you want the full Third Person Controller experience. With walk, run, jump, falling, landing, etc… Mixed with a real animation state machine.

This basically gives you Unity Style Player controller support like:

Using my Babylon Toolkit, I created a playground that has a Sample Scene with environment and baked lighting, full scenery physics including compound colliders for custom walls and tunnels, a fully rigged Player Armature with animations including Blend Tree and Animation Controller support and exported as interactive GLTF files that I attach a ThirdPersonPlayerController script at runtime:

Third Person Player Controller Demo

Note: You can use WASD Keys, Arrow Keys, Gamepads and Mobile Controls.
Hold Shift To Run

3 Likes

Yo @Leandro_Roggerone

1 Like

It should still be noted that the physics for character animation can cost a little more than moveWithCollision() which can be precise if it is well managed as in the CharacterControler class that I showed.
I use it with some adaptation and it’s quite precise, it manages many things like the camera which always remains behind the player, even if a wall is placed between the camera and the player.

Using physics can be good, but you have to monitor performance. Because this also means that the character must interact with physical objects in the scene, a physical ground… And depending on the size of the game, this can have a cost.

1 Like

@Dad72 is correct, using physics does cost a little bit more, but very much worth it.

Note: the newer commercial grade Havok Physics Engine for BabylonJS and the V2 Physics System that no longer requires a BABYLON.AbstractMesh to host the physics impostor… Is just freaking awesome.

But as you see you have a couple of choices on how to make Character Controllers :slight_smile:

1 Like

Wow … it is amazing !!!
Please would you explain:
What is the relation with Unity ? Is it possible to share assets / libraries between BB and Unity ?
As far as I know , Unity is written in .net languaje.
I will try to integrate your tool very soon.
btw ;
Any other project using this tool you can mention would be great for me
Thanks for your words.

We are just using Unity as the Editor to export out content as gltf and then the babylon.toolkit.js has ALOT of Unity-Like functionality.

Take a look at the getting started videos: Babylon Toolkit Boot Camp Videos

1 Like

A few projects made with the babylon toolkit:

https://forum.babylonjs.com/t/babylon-toolkit-mvrk-vx-360-platform/

https://forum.babylonjs.com/t/babylon-toolkit-the-masked-singer/

https://forum.babylonjs.com/t/babylon-toolkit-st-jude-sequin-forest/

https://forum.babylonjs.com/t/babylon-toolkit-verizon-virtual-events/

https://forum.babylonjs.com/t/babylon-toolkit-revit-automation/

https://forum.babylonjs.com/t/babylon-toolkit-marianos-configurators/

2 Likes