BabylonJS-CharacterController
BabylonJS-CharacterController copied to clipboard
How can I copy an avatar and synchronize remotely?
Hello,
Thanks for sharing this amazing library. I am trying to build a web game allowing multi players. In multi player game, an avatar controlled by player should be displayed in all the other peer players' device. I am looking for an easy way to copy an avatar and synchronize remotely.
First question: Is there a way to get (and set) the current animation and the frame number running on the avatar? For example, like this:
animCurrent= ccontroller.getCurrentAnim(); iFrameCurrent= animCurrent.getCurrentFrameNumber(); sendToRemote(annimCurrent.id, iFrameCurrent) ...(in remote device below from this line).... (idAnim, iFrame)= receiveFromRemoe() ccontroller.setCurrentAnim(idAnim); ccontroller.setFrameNumberAnim(iFrame);
Second question: How can I get and set state of an avatar so that I can simply copy and paste the current state of an avatar? For example, like this:
stateAvatar= avatar.getState(); ...(in remote device below from this line).... avatarRemote.setState(stateAvatar);
Any comment or advice is welcome. Thanks in advance.