diff --git a/Source/WidgetInteraction/Private/VRWidgetInteractionComponent.cpp b/Source/WidgetInteraction/Private/VRWidgetInteractionComponent.cpp index 8ad9ac731519ea6100834a34231fb3440e47257b..dc71de2e40f586e7c5d00b579e78be716e1d65b2 100644 --- a/Source/WidgetInteraction/Private/VRWidgetInteractionComponent.cpp +++ b/Source/WidgetInteraction/Private/VRWidgetInteractionComponent.cpp @@ -4,9 +4,18 @@ #include "Runtime/InputCore/Classes/InputCoreTypes.h" #include "Runtime/Engine/Classes/Components/InputComponent.h" +#include "ConstructorHelpers.h" #include "VirtualRealityPawn.h" -UVRWidgetInteractionComponent::UVRWidgetInteractionComponent() {} + +UVRWidgetInteractionComponent::UVRWidgetInteractionComponent() { + InteractionRay = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Interaction Ray")); + auto MeshAsset = ConstructorHelpers::FObjectFinder<UStaticMesh>(TEXT("StaticMesh'/Engine/BasicShapes/Cone.Cone'")); + if (MeshAsset.Object != nullptr) + { + InteractionRay->SetStaticMesh(MeshAsset.Object); + } +} void UVRWidgetInteractionComponent::Init() { diff --git a/Source/WidgetInteraction/Public/VRWidgetInteractionComponent.h b/Source/WidgetInteraction/Public/VRWidgetInteractionComponent.h index 76360f28ec22c400beef0cec16f23b66318919dc..74f939500172db1a373ce408605f79fff09c6583 100644 --- a/Source/WidgetInteraction/Public/VRWidgetInteractionComponent.h +++ b/Source/WidgetInteraction/Public/VRWidgetInteractionComponent.h @@ -4,6 +4,8 @@ #include "CoreMinimal.h" #include "Components/WidgetInteractionComponent.h" +#include "Components/StaticMeshComponent.h" + #include "VRWidgetInteractionComponent.generated.h" /** @@ -23,5 +25,7 @@ public: protected: void OnFire(bool val); + UPROPERTY(VisibleAnywhere) UStaticMeshComponent* InteractionRay; + DECLARE_DELEGATE_OneParam(FFireDelegate, bool); };