Ejemplo n.º 1
0
        static void TrackAvatar(string avatarId, GameObject avatarObject)
        {
            Log.Info($"Tracking avatar {avatarId}");

            // get all of the avatar's bones and colliders
            List <DynamicBone>         bones     = avatarObject.GetComponentsInChildren <DynamicBone>(true).ToList();
            List <DynamicBoneCollider> colliders = avatarObject.GetComponentsInChildren <DynamicBoneCollider>(true).ToList();

            // store the default ones
            List <BoneMap> newBoneMap = new List <BoneMap>();

            bones.ForEach(bone => {
                newBoneMap.Add(new BoneMap()
                {
                    Bone = bone
                });
            });

            AvatarMap newMap = new AvatarMap()
            {
                ExtraCollisions = newBoneMap
            };

            // add the avatar to the map
            m_map.Add(avatarId, newMap);

            // make the avatar's colliders interact with other avatars
            UpdateCollisions(avatarId, colliders);
        }
Ejemplo n.º 2
0
        static void RemoveAvatar(string avatarId)
        {
            Log.Info($"Removing avatar {avatarId}");

            AvatarMap currentMap = m_map[avatarId];

            // remove current avatar's colliders from everywhere
            currentMap.ExtraCollisions.ForEach(bone =>
            {
                bone.Colliders.ForEach(collider => bone.Bone.m_Colliders.Remove(collider));
            });

            m_map.Remove(avatarId);
        }