'Animating the multi user object
I'm new to A-Frame js and am now stuck in one problem. Problem is that I'm using a networked A-Frame library for a multi-user experience. And have on the character which I'm showing there having some animation. So, by using some Jquery code I tried to add some animation controls. When I'm using that animation in the character which is shown on my own screen is animating, But in real scenarios, if I'm moving then that person should see me animating. Because I'm moving the camera or doing activities, not that avatar.
<a-assets>
<a-asset-item id="person" src="./person/scene.gltf"></a-asset-item>
</a-assets>
This is the person model which I'm using.
<!-- ++++++++++++++++++++++++++ Person Template ++++++++++++++++ -->
<template id="person_template">
<a-entity
id="model"
gltf-model="#person"
animation-mixer="clip: Rig|man_idle;"
scale="0.02 0.02 0.02"
>
</a-entity>
</template>
This is the template that I'm using in the networked entity.
<a-entity
id="rig"
position="-9.495 0.770 6.282"
position="-5 0.2 1"
rotation="0 180 0"
movement-controls="speed:0.15; constrainToNavMesh: true;"
>
<a-entity camera="active:true" position="0 2 0" look-controls>
<a-entity
id="player"
networked="template:#person_template;attachTemplateToLocal:false;"
movement-controls="speed:0.15; constrainToNavMesh: true;"
look-controls
wasd-controls="acceleration:15"
>
</a-entity>
</a-entity>
</a-entity>
This is the networked entity i used to make multi-user env.
$(document).ready(function () {
$(this).keydown(function (e) {
switch (e.which) {
case 37:
$("#model").attr("animation-mixer", "clip: Rig|man_walk_in_place;");
$("#model").attr("rotation", "0 -90 0");
break;
}
This is the code I write to add animation which, is visible by another person in the controlling avatar.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|