Skip to content
Snippets Groups Projects
Commit 0e2857d7 authored by Jonathan Ehret's avatar Jonathan Ehret
Browse files

add vive trackers as motion controller components and make them accessible...

add vive trackers as motion controller components and make them accessible (and render if available)
parent 97dca3c6
No related branches found
No related tags found
No related merge requests found
......@@ -52,6 +52,17 @@ AVirtualRealityPawn::AVirtualRealityPawn(const FObjectInitializer& ObjectInitial
HmdRightMotionController->SetShowDeviceModel(true);
HmdRightMotionController->SetVisibility(false);
HmdTracker1 = CreateDefaultSubobject<UMotionControllerComponent>(TEXT("HmdTracker1"));
HmdTracker1->SetupAttachment(RootComponent);
HmdTracker1->SetTrackingSource(EControllerHand::Special_1);
HmdTracker1->SetShowDeviceModel(true);
HmdTracker1->SetVisibility(false);
HmdTracker2 = CreateDefaultSubobject<UMotionControllerComponent>(TEXT("HmdTracker2"));
HmdTracker2->SetupAttachment(RootComponent);
HmdTracker2->SetTrackingSource(EControllerHand::Special_2);
HmdTracker2->SetShowDeviceModel(true);
HmdTracker2->SetVisibility(false);
}
void AVirtualRealityPawn::OnForward_Implementation(float Value)
......@@ -146,6 +157,16 @@ UMotionControllerComponent* AVirtualRealityPawn::GetHmdRightMotionControllerComp
return HmdRightMotionController;
}
UMotionControllerComponent* AVirtualRealityPawn::GetHmdTracker1MotionControllerComponent()
{
return HmdTracker1;
}
UMotionControllerComponent* AVirtualRealityPawn::GetHmdTracker2MotionControllerComponent()
{
return HmdTracker2;
}
USceneComponent* AVirtualRealityPawn::GetHeadComponent()
{
return Head;
......@@ -225,6 +246,12 @@ void AVirtualRealityPawn::BeginPlay()
HmdLeftMotionController->SetVisibility(ShowHMDControllers);
HmdRightMotionController->SetVisibility(ShowHMDControllers);
if (HmdTracker1->IsActive()) {
HmdTracker1->SetVisibility(ShowHMDControllers);
}
if (HmdTracker2->IsActive()) {
HmdTracker2->SetVisibility(ShowHMDControllers);
}
LeftHand->AttachToComponent(HmdLeftMotionController, FAttachmentTransformRules::SnapToTargetIncludingScale);
RightHand->AttachToComponent(HmdRightMotionController, FAttachmentTransformRules::SnapToTargetIncludingScale);
......
......@@ -50,6 +50,8 @@ public:
UFUNCTION(Category = "Pawn") UDisplayClusterSceneComponent* GetLeftHandtargetComponent();
UFUNCTION(Category = "Pawn") UMotionControllerComponent* GetHmdLeftMotionControllerComponent();
UFUNCTION(Category = "Pawn") UMotionControllerComponent* GetHmdRightMotionControllerComponent();
UFUNCTION(Category = "Pawn") UMotionControllerComponent* GetHmdTracker1MotionControllerComponent();
UFUNCTION(Category = "Pawn") UMotionControllerComponent* GetHmdTracker2MotionControllerComponent();
UFUNCTION(Category = "Pawn") USceneComponent* GetHeadComponent();
UFUNCTION(Category = "Pawn") USceneComponent* GetLeftHandComponent();
......@@ -93,9 +95,13 @@ protected:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Pawn", meta = (AllowPrivateAccess = "true")) UDisplayClusterSceneComponent* LeftHandTarget = nullptr;
// Use only when handling cross-device (PC, HMD, CAVE/ROLV) compatibility manually. HMD left motion controller.
UMotionControllerComponent* HmdLeftMotionController = nullptr;
UPROPERTY() UMotionControllerComponent* HmdLeftMotionController = nullptr;
// Use only when handling cross-device (PC, HMD, CAVE/ROLV) compatibility manually. HMD right motion controller.
UMotionControllerComponent* HmdRightMotionController = nullptr;
UPROPERTY() UMotionControllerComponent* HmdRightMotionController = nullptr;
// used only for HMDs, tested with the additional Vive Trackers
UPROPERTY() UMotionControllerComponent* HmdTracker1 = nullptr;
UPROPERTY() UMotionControllerComponent* HmdTracker2 = nullptr;
// PC: Camera, HMD: Camera, CAVE/ROLV: Shutter glasses.
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Pawn", meta = (AllowPrivateAccess = "true")) USceneComponent* Head = nullptr;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment