5#include "Components/SphereComponent.h"
6#include "Kismet/GameplayStatics.h"
7#include "NavAreas/NavArea_Obstacle.h"
11 PrimaryActorTick.bCanEverTick =
true;
14 static ConstructorHelpers::FObjectFinder<UStaticMesh> ButtonMeshFinder(
15 TEXT(
"StaticMesh'/PixoCore/Meshes/InteractableObjects/SM_ButtonMoving.SM_ButtonMoving'"));
16 UStaticMesh* ButtonMesh = ButtonMeshFinder.Object;
18 static ConstructorHelpers::FObjectFinder<UStaticMesh> ButtonSupportMeshFinder(
19 TEXT(
"StaticMesh'/PixoCore/Meshes/InteractableObjects/SM_ButtonSupport.SM_ButtonSupport'"));
20 UStaticMesh* ButtonSupportMesh = ButtonSupportMeshFinder.Object;
22 USceneComponent* DefaultRootComponent = CreateDefaultSubobject<USceneComponent>(
"DefaultRootComponent");
23 SetRootComponent(DefaultRootComponent);
25 ButtonSupportComp = CreateDefaultSubobject<UStaticMeshComponent>(
"ButtonSupport");
30 ButtonMovingComp = CreateDefaultSubobject<UStaticMeshComponent>(
"ButtonMoving");
41 PointLightComp = CreateDefaultSubobject<UPointLightComponent>(
"PointLight");
49 TextRenderComp = CreateDefaultSubobject<UTextRenderComponent>(
"TextRender");
61 Super::Tick(DeltaSeconds);
72 bVisible ? ECollisionEnabled::QueryAndPhysics : ECollisionEnabled::NoCollision);
84 ButtonMovingComp->SetVectorParameterValueOnMaterials(
"ButtonColor", FVector(0.207881f, 0.71875f, 0.074695f));
89 ButtonMovingComp->SetVectorParameterValueOnMaterials(
"ButtonColor", FVector(1.f, 0.f, 0.f));
94 ButtonMovingComp->SetVectorParameterValueOnMaterials(
"ButtonColor", FVector(0.1f, 0.1f, 0.1f));
112 Super::GetLifetimeReplicatedProps(OutLifetimeProps);
123 FOnTimelineFloat TimelineProgress;
124 TimelineProgress.BindUFunction(
this, FName(
"MovingButtonTimelineProgress"));
127 FOnTimelineEventStatic TimelineFinished;
128 TimelineFinished.BindUFunction(
this, FName(
"MovingButtonTimelineFinished"));
138void AInteractionButton::ButtonPress_Implementation()
150void AInteractionButton::ButtonRelease_Implementation()
158 UPrimitiveComponent* OtherComp, int32 OtherBodyIndex,
bool bFromSweep,
159 const FHitResult& SweepResult)
166 if (
APixoVRHand* Hand = Cast<APixoVRHand>(OtherActor))
168 if (Hand->HandMotionSource == EControllerHand::Left)
170 PlayerController = Cast<APlayerController>(Hand->OwningCharacter->GetController());
171 const FForceFeedbackParameters ForceFeedbackParameters;
174 else if (Hand->HandMotionSource == EControllerHand::Right)
176 PlayerController = Cast<APlayerController>(Hand->OwningCharacter->GetController());
177 const FForceFeedbackParameters ForceFeedbackParameters;
199 case ETimelineDirection::Forward:
203 case ETimelineDirection::Backward:
APixoVRHand is an actor class that represents a hand in the VR environment.