Hey! Guys I am quite new to building on ReadyPlayerMe and I am currently working on a multiplayer based collaborative VR application where I am using ReadyPlayerMe’s Half Body Avatars
After a lot of hit and trials I finally got half body avatars to work but the problem now is the avatar after being downloaded is spawning way forward to the position of the placeholder.
So lets say the placeholder is at the center then that avatar is being loaded at least 5 to 10 units away from the placeholder even though the transfer mesh is working and is replacing the placeholder with the halfbody avatar.
I am really stuck on this and causing a lot of delays for so please it would be great if anyone could help me out on this.
This is the code
#if PHOTON_UNITY_NETWORKING && READY_PLAYER_ME
using Photon.Pun;
using UnityEngine;
using ReadyPlayerMe.Core;
namespace ReadyPlayerMe.PhotonSupport
{
/// <summary>
/// Used on Ready Player Me
/// </summary>
[RequireComponent(typeof(PhotonView))]
public class NetworkPlayer : MonoBehaviour
{
private const string SET_PLAYER_METHOD = "SetPlayer";
[SerializeField] private AvatarConfig config;
[SerializeField] private SkinnedMeshRenderer m_SkinnedMeshRenderer;
private PhotonView photonView;
private Transform leftEye;
private Transform rightEye;
private void Awake()
{
photonView = GetComponent<PhotonView>();
leftEye = AvatarBoneHelper.GetLeftEyeBone(transform, false);
rightEye = AvatarBoneHelper.GetRightEyeBone(transform, false);
}
/// <summary>
/// Calls PunRPC with the avatar URL as paramater to load the local and remote avatars.
/// </summary>
/// <param name="url">Avatar URL</param>
public void LoadAvatar(string url)
{
photonView.RPC(SET_PLAYER_METHOD, RpcTarget.AllBuffered, url);
}
[PunRPC]
private void SetPlayer(string incomingUrl)
{
AvatarObjectLoader loader = new AvatarObjectLoader();
loader.AvatarConfig = config;
loader.LoadAvatar(incomingUrl);
loader.OnCompleted += (sender, args) =>
{
leftEye.transform.localPosition = AvatarBoneHelper.GetLeftEyeBone(args.Avatar.transform, false).localPosition;
rightEye.transform.localPosition = AvatarBoneHelper.GetRightEyeBone(args.Avatar.transform, false).localPosition;
//Destroy(gameObject);
Destroy(args.Avatar);
AvatarMeshHelper.TransferMesh(args.Avatar, gameObject);
};
}
}
}
#endif