For some reason the controller is not being tracked with the:
MotionController->SetTrackingSource(EControllerHand::Right);
So I used the same idea from the previous class, by creating a SetHand() method, so it looks like this:
HandController.h
public:
// Sets default values for this actor's properties
AHandController();
void SetHand(FName Hand);
HandController.cpp
void AHandController::SetHand(FName Hand)
{
MotionController->SetTrackingMotionSource(Hand);
}
VRPawn.cpp
// Include this header file
#include "XRMotionControllerBase.h"
// Called when the game starts or when spawned
void AVRPawn::BeginPlay()
{
Super::BeginPlay();
// Setup Controllers
if (HandControllerClass)
{
RightController = GetWorld()->SpawnActor<AHandController>(HandControllerClass);
RightController->AttachToComponent(VRRoot, FAttachmentTransformRules::KeepRelativeTransform);
RightController->SetOwner(this);
RightController->SetHand(FXRMotionControllerBase::RightHandSourceId);
}
}
Now the controller is being tracked correctly. They must have changed the SetTrackingSource() method for 4.25