I'm trying to make multiplayer in Unreal Engine 4.15 and to implement Oculus Avatars as an representation of players.
Problem I'm having is that the client doesn't see avatars at all and movement of all avatars is copied from avatar possessed by server (server sees all avatars).
I have managed to get personalized avatars from oculus platform for server and client player characters but still movement is copied from server and clients can not see avatars at all.
Hierarchy looks like this:
I have player character blueprint that manages player movement and all interactions.
This Player Character has child actor added as component of localAvatar class which is copied from AvatarSample project shared by Oculus.
Here is how I have set replication for child actor component:
I tried to set different replication methods for event that initializes avatars but I couldn't get the desired effect.
When I changed replication method of initializePlayerAvatar to replicated on client, client was able to see it's own and server's avatars but server could see client avatar.
This event looks like this and it's called by pressing U key:
void ALocalAvatar::InitializeAvatar(FString OculusId)
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface("OculusSubsystemPlatform");
OnLoginCompleteDelegateHandle = IdentityInterface->AddOnLoginCompleteDelegate_Handle(0, FOnLoginCompleteDelegate::CreateUObject(this, &ALocalAvatar::OnLoginComplete));
uint64 OculusIdAsUInt64 = FCString::Strtoui64(*OculusId, NULL, 10);
AvatarHands[ovrHand_Left] = nullptr;
AvatarHands[ovrHand_Right] = nullptr;
So my questions are:
How to separate avatar movement from server so that movement is not copied between all avatars?
How to properly replicate avatars so they could be seen both by server and clients?