ssatguru / BabylonJS-CharacterController

A CharacterController for BabylonJS
Apache License 2.0
217 stars 47 forks source link

Please help me use a new avatar: I made a Playground example. #81

Open warrenchopin opened 1 week ago

warrenchopin commented 1 week ago

Following is a Playground example to use a new avatar. You can see the source code there. Please help me fix it:

https://playground.babylonjs.com/#AJA5J6#361

The loaded container has three meshes. How to feed to CharacterController()? Do I have to select only one of them or do I have to do parenting? How to set skeleton? Also, how to set animation?

Thanks in advance.

warrenchopin commented 1 week ago

Ths is a playground exmaple of Dude from Babylon.js site. How can I set animation? https://playground.babylonjs.com/#92Y727#450

ssatguru commented 1 week ago

Your scriptloader doesn't seem to be working Anyway I copy/pasted the charactercontroller script into the playground. Here is the basic code https://playground.babylonjs.com/#W48M0E Please see documentation/examples on how to setup the player, its ellipsoid, camera etc. example here https://github.com/ssatguru/BabylonJS-CharacterController-Samples/tree/master/sample-global

For questions on glbs, animationgroups etc goto babylonjs forum

warrenchopin commented 6 days ago

Thanks for your help. i can see aniamtions ('Idle', 'Walk', 'Run', etc.) of the avatar in Inspector window of Playground. I set animation as following.

            cc.setIdleAnim("Idle",1,true);
            cc.setWalkAnim("Walk",1,true);
            cc.setRunAnim("Run",1,true);

Playground: https://playground.babylonjs.com/#W48M0E#2

But it doesn't work. What was wrong?

ssatguru commented 3 days ago

This character has animation groups not animation range.

You can set the animation range in cosntructor https://github.com/ssatguru/BabylonJS-CharacterController?tab=readme-ov-file#to-instantiate

or pass as parameter https://github.com/ssatguru/BabylonJS-CharacterController?tab=readme-ov-file#to-change-animation-range-name--animation-group-and-their-parameters

also see https://github.com/ssatguru/BabylonJS-CharacterController/blob/master/tst/testAnimationGroup.js#L139