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

Merge branch 'develop' into 'feature/walking_behavior'

# Conflicts:
#   Source/DisplayClusterExtensions/Private/VirtualRealityPawn.cpp
#   Source/DisplayClusterExtensions/Public/VirtualRealityPawn.h
parents 14f1f314 b04105bb
No related branches found
No related tags found
No related merge requests found
......@@ -61,6 +61,18 @@ AVirtualRealityPawn::AVirtualRealityPawn(const FObjectInitializer& ObjectInitial
CapsuleColliderComponent->SetCollisionResponseToChannel(ECollisionChannel::ECC_WorldStatic, ECollisionResponse::ECR_Block);
CapsuleColliderComponent->SetupAttachment(CameraComponent);
CapsuleColliderComponent->SetCapsuleSize(40.0f, 96.0f);
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)
......@@ -141,6 +153,16 @@ UMotionControllerComponent* AVirtualRealityPawn::GetHmdRightMotionControllerComp
return HmdRightMotionController;
}
UMotionControllerComponent* AVirtualRealityPawn::GetHmdTracker1MotionControllerComponent()
{
return HmdTracker1;
}
UMotionControllerComponent* AVirtualRealityPawn::GetHmdTracker2MotionControllerComponent()
{
return HmdTracker2;
}
USceneComponent* AVirtualRealityPawn::GetHeadComponent()
{
return Head;
......@@ -220,6 +242,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);
......@@ -341,7 +369,6 @@ void AVirtualRealityPawn::OnBeginFire_Implementation()
if (!GetWorld()->LineTraceSingleByObjectType(Hit, Start, End, Params))
return;
// UE_LOG(LogTemp, Warning, GetDisplayName(Hit.GetActor()));
HitActor = Hit.GetActor();
// try to cast HitActor int a Grabable if not succeeded will become a nullptr
......@@ -363,7 +390,7 @@ void AVirtualRealityPawn::OnBeginFire_Implementation()
}
else if (ClickableActor != nullptr && Hit.Distance < MaxClickDistance)
{
ClickableActor->OnClicked_Implementation();
ClickableActor->OnClicked_Implementation(Hit.Location);
}
}
......
......@@ -20,9 +20,9 @@ class IClickable
GENERATED_IINTERFACE_BODY()
public:
// function that will be called when clickable actor got clicked
// function that will be called when clickable actor got clicked, and passed the world pos of the click
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = Gameplay)
void OnClicked();
void OnClicked(FVector WorldPositionOfClick);
};
......
......@@ -53,6 +53,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();
......@@ -96,9 +98,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.
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Pawn", meta = (AllowPrivateAccess = "true")) UMotionControllerComponent* HmdLeftMotionController = nullptr;
UPROPERTY() UMotionControllerComponent* HmdLeftMotionController = nullptr;
// Use only when handling cross-device (PC, HMD, CAVE/ROLV) compatibility manually. HMD right motion controller.
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Pawn", meta = (AllowPrivateAccess = "true")) 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