Skip to content
Snippets Groups Projects
Commit 13fcd5a3 authored by Jonathan Wendt's avatar Jonathan Wendt
Browse files

add desktop interaction

parent 67cf10cf
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,8 @@
#include "WidgetInteraction.h"
#include "HeadMountedDisplayFunctionLibrary.h"
#include "IDisplayCluster.h"
#include "IDisplayClusterClusterManager.h"
#include "Engine.h"
#define LOCTEXT_NAMESPACE "FWidgetInteractionModule"
......@@ -21,9 +23,14 @@ void FWidgetInteractionModule::OnWorldTickStart(ELevelTick level_tick, float val
{
auto worlds = GEngine->GetWorldContexts();
if (widget_interaction_cmp_ != nullptr && widget_interaction_cmp_->IsValidLowLevel() == true)
if (widget_interaction_cmp_ != nullptr) {
if (widget_interaction_cmp_->IsValidLowLevel() == true) {
return;
}
else {
widget_interaction_cmp_ = nullptr;
}
}
for (auto & world_context : worlds)
{
......@@ -36,14 +43,28 @@ void FWidgetInteractionModule::OnWorldTickStart(ELevelTick level_tick, float val
if (vr_pawn == nullptr)
continue;
FString name = FString("flystick");
auto component_class = UMotionControllerComponent::StaticClass();
if (UHeadMountedDisplayFunctionLibrary::IsHeadMountedDisplayEnabled())
{
FString name = "";
UClass* component_class = UMotionControllerComponent::StaticClass();
if (IDisplayCluster::Get().GetClusterMgr()->IsStandalone()) {
//if this is a standalone setup ...
if (UHeadMountedDisplayFunctionLibrary::IsHeadMountedDisplayEnabled()) {
//.. with an HMD, we attach the intercation component to the right hand
name = FString("RightMotionController");
component_class = UMotionControllerComponent::StaticClass();
}
else {
//... without an HMD, we also attach it to the virtual right hand, since it exists in this case
name = TEXT("RightMotionController");
component_class = UMotionControllerComponent::StaticClass();
}
}
else {
//if this is a cluster setup we attach it to the flystick
name = TEXT("flystick");
component_class = UMotionControllerComponent::StaticClass();
}
auto parent_vec = vr_pawn->GetComponentsByClass(component_class);
for (auto parent : parent_vec)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment