From 0dbe6c1276861c0c73f6198d16e153f22b37ec7b Mon Sep 17 00:00:00 2001 From: Jonathan Wendt <wendt@vr.rwth-aachen.de> Date: Tue, 11 Jun 2019 18:06:29 +0200 Subject: [PATCH] allow to set the interaction ray invisible --- Source/WidgetInteraction/Private/RwthComponent.cpp | 6 +++++- Source/WidgetInteraction/Private/WidgetInteraction.cpp | 4 ++++ Source/WidgetInteraction/Public/RwthComponent.h | 2 ++ Source/WidgetInteraction/Public/WidgetInteraction.h | 4 +++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Source/WidgetInteraction/Private/RwthComponent.cpp b/Source/WidgetInteraction/Private/RwthComponent.cpp index d74511c..2685e08 100644 --- a/Source/WidgetInteraction/Private/RwthComponent.cpp +++ b/Source/WidgetInteraction/Private/RwthComponent.cpp @@ -12,7 +12,7 @@ URwthComponent::URwthComponent() void URwthComponent::Init() { - bShowDebug = true; + SetVisibility(true); InteractionDistance = 1000000.0f; auto input_cmp = dynamic_cast<UInputComponent*>(GetOwner()->GetComponentByClass(UInputComponent::StaticClass())); @@ -23,6 +23,10 @@ void URwthComponent::Init() RegisterComponent(); } +void URwthComponent::SetVisibility(bool visible) { + bShowDebug = visible; +} + void URwthComponent::OnFire(bool val) { if (val == true) diff --git a/Source/WidgetInteraction/Private/WidgetInteraction.cpp b/Source/WidgetInteraction/Private/WidgetInteraction.cpp index 40b70e8..f414d1d 100644 --- a/Source/WidgetInteraction/Private/WidgetInteraction.cpp +++ b/Source/WidgetInteraction/Private/WidgetInteraction.cpp @@ -89,6 +89,10 @@ void FWidgetInteractionModule::OnWorldTickStart(ELevelTick level_tick, float val } } +URwthComponent* FWidgetInteractionModule::GetWidgetInteractionComponent() { + return widget_interaction_cmp_; +} + void FWidgetInteractionModule::CreateWidgetInteraction(USceneComponent * parent, AVirtualRealityPawn* outer) { widget_interaction_cmp_ = NewObject<URwthComponent>(outer, URwthComponent::StaticClass()); diff --git a/Source/WidgetInteraction/Public/RwthComponent.h b/Source/WidgetInteraction/Public/RwthComponent.h index fb76578..d5fda41 100644 --- a/Source/WidgetInteraction/Public/RwthComponent.h +++ b/Source/WidgetInteraction/Public/RwthComponent.h @@ -18,6 +18,8 @@ public: void Init(); + void SetVisibility(bool visible); + protected: void OnFire(bool val); diff --git a/Source/WidgetInteraction/Public/WidgetInteraction.h b/Source/WidgetInteraction/Public/WidgetInteraction.h index 747a3bd..d1b7bb7 100644 --- a/Source/WidgetInteraction/Public/WidgetInteraction.h +++ b/Source/WidgetInteraction/Public/WidgetInteraction.h @@ -7,7 +7,7 @@ #include "RwthComponent.h" #include "Modules/ModuleManager.h" -class FWidgetInteractionModule : public IModuleInterface +class WIDGETINTERACTION_API FWidgetInteractionModule : public IModuleInterface { public: @@ -18,6 +18,8 @@ public: UFUNCTION() void OnWorldTickStart(ELevelTick, float); + URwthComponent* GetWidgetInteractionComponent(); + private: void CreateWidgetInteraction(USceneComponent * parent, AVirtualRealityPawn* outer); -- GitLab