Training Stream - Sam and Wes' VR Stream: Cameras, Multiplayer, Tips and Tricks! - Live from Epic HQ

Hi guys. I got the same issue and I managed to fix it in quite simple way.
First I did some research and I found many threads about the same problem. I post them at the end of the post so you can make some additional reading if you want to.

So in UMotionControllerComponent inside the PollControllerState method there is an authority check…


   
if (IsInGameThread())
{
     // Cache state from the game thread for use on the render thread
     const AActor* MyOwner = GetOwner();
     const APawn* MyPawn = Cast<APawn>(MyOwner);
     bHasAuthority = MyPawn ? MyPawn->IsLocallyControlled() : (MyOwner->Role == ENetRole::ROLE_Authority);
}

if (bHasAuthority)
    {
        TArray<IMotionController*> MotionControllers = IModularFeatures::Get().GetModularFeatureImplementations<IMotionController>(IMotionController::GetModularFeatureName());
        for (auto MotionController : MotionControllers)
        {.....


Authority check in here is not enough because what we do later is telling the engine to get all motion controllers out there and process them. So if one of them got authority you still update them all.
PollControllerState is a private method so you cannot edit definition of that method. So instead I wrote this piece of code inside the TickComponent in my UMotionControllerComponent derived class



void UNetworkMotionControllerComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction)
{
    Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
    const AActor* MyOwner = GetOwner();
    const APawn* MyPawn = Cast<APawn>(MyOwner);
    bHasAuthority = MyPawn ? MyPawn->IsLocallyControlled() : throw;
    if (bHasAuthority == false)
    {
        SetAssociatedPlayerIndex(-1);
// this line is where we tell the engine to not to use this controller. PlayerIndex variable is used differently in platform specific places. eg. SteamVR uses some 2 dimensional array to store the controllers and then only checks if they are smaller than the value so it can be a better solution to set it to maximum value of int instead. You have to check it up with your platform. (-1 works well with oculus rift and htc vive)
    }

    if (bIsActive&&PlayerIndex == 0)
    {
        FVector Position;
        FRotator Orientation;
        float WorldToMeters = GetWorld() ? GetWorld()->GetWorldSettings()->WorldToMeters : 100.0f;
        const bool bNewTrackedState = PollControllerState(Position, Orientation, WorldToMeters);
        if (bNewTrackedState)
        {
            Server_SetRelativeLocationAndRotation(Position, Orientation);
            //SetRelativeLocationAndRotation(Position, Orientation);
        }
//rest of the default motioncontrollercomponent's code


So basically you have to do those things:
set PlayerIndex != 0 on the controllers that should’t get the data from you motion controller.
implement the function that will set the position and rotation. It have to be done on server so the other clients can see it. I copied the code from USceneComponent::SetRelativeLocationAndRotation() and it woks like a charm.

Please keep in mind that this is the working solution but its like alpha alpha version. I’m sure I’ll try to optimize this so I don’t have to do all those casting inside of a tick function and get rid of the throwing exceptions when there is no Pawn. Do not use this as ready to go solution in your projects. I posted this only as a reference so you can get on going with your projects if you stucked.

Links to read if you want to get more information:

https://forums.unrealengine.com/development-discussion/vr-ar-development/79167-motion-controllers-and-networking
https://forums.unrealengine.com/development-discussion/vr-ar-development/73125-motioncontroller-input-for-multi-player

https://forums.unrealengine.com/development-discussion/vr-ar-development/79167-motion-controllers-and-networking?107140-Motion-controllers-and-networking=
VR: Cameras, Multiplayer, Tips & Tricks | Live Training | Unreal Engine - YouTube at 14:35
and the thread about this livestream
Training Stream - Sam and Wes' VR Stream: Cameras, Multiplayer, Tips and Tricks! - Live from Epic HQ - Announcements - Epic Developer Community Forums

any news on this?