Documentation for the Unreal C++ Plugin
Loading...
Searching...
No Matches
PixoVRHand.cpp
Go to the documentation of this file.
1// Copyright(c) Pixo Group. All Rights Reserved.
2#include "PixoVRHand.h"
3#include "GripMotionControllerComponent.h"
4#include "PixoVRCharacter.h"
7#include "Kismet/GameplayStatics.h"
8#include "Kismet/KismetMathLibrary.h"
9#include "Kismet/KismetSystemLibrary.h"
10
11// Sets default values
13{
14 // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
15 PrimaryActorTick.bCanEverTick = true;
16
17 Root = CreateDefaultSubobject<USceneComponent>("Root");
18 Root->SetupAttachment(RootComponent);
19
20 MotionController = CreateDefaultSubobject<UGripMotionControllerComponent>("MotionController");
22 {
23 MotionController->SetupAttachment(Root);
24 MotionController->SetGenerateOverlapEvents(false);
25 MotionController->SetRelativeLocation(FVector(65.0f, -43.25f, -11.51f));
26 MotionController->OnGripOutOfRange.AddDynamic(this, &APixoVRHand::OnObjectOutOfRange);
27 }
28
29 GrabSphere = CreateDefaultSubobject<USphereComponent>("GrabSphere");
30 GrabSphere->SetupAttachment(MotionController);
31 GrabSphere->SetCollisionProfileName("OverlapAll");
32 GrabSphere->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
33 GrabSphere->SetVisibility(true, true);
34 GrabSphere->SetHiddenInGame(false, true);
35 GrabSphere->SetSphereRadius(4.0f);
36 GrabSphere->SetRelativeLocation(FVector(2.0f, 0.0f, -2.5f));
37 GrabSphere->SetIsReplicated(true);
38
39 HandMesh = CreateDefaultSubobject<USkeletalMeshComponent>("HandMesh");
40 HandMesh->SetupAttachment(MotionController);
41
42 LaserMesh = CreateDefaultSubobject<UStaticMeshComponent>("Laser");
43 LaserMesh->SetupAttachment(HandMesh, "LaserSocket");
44 static ConstructorHelpers::FObjectFinder<UStaticMesh> LaserMeshFinder(TEXT("StaticMesh'/PixoCore/Meshes/Tools/SM_LaserPointer.SM_LaserPointer'"));
45 LaserMesh->SetStaticMesh(LaserMeshFinder.Object);
46 LaserMesh->SetVisibility(false);
47
48 static ConstructorHelpers::FObjectFinder<USoundCue> LaserSoundFinder(TEXT("SoundCue'/PixoCore/Audio/SFX/LaserToggle_Cue.LaserToggle_Cue'"));
49 LaserSound = NewObject<USoundCue>();
50 LaserSound = LaserSoundFinder.Object;
51
52 TouchComponent = CreateDefaultSubobject<UWidgetInteractionComponent>("TouchComponent");
53 TouchComponent->SetupAttachment(HandMesh, "TouchIntr");
54 TouchComponent->SetRelativeLocation(FVector(6.8, -1.3, 0));
55 TouchComponent->SetRelativeRotation(FRotator(0.0,170.0, 0.0));
56 TouchComponent->TraceChannel = ECollisionChannel::ECC_Visibility;
57 TouchComponent->InteractionDistance = 10.0;
58 TouchComponent->bEnableHitTesting = true;
59 TouchComponent->OnHoveredWidgetChanged.AddDynamic(this, &APixoVRHand::OnTouchWidget);
60 TouchComponent->SetAutoActivate(false);
61
62 WristMenu = CreateDefaultSubobject<UChildActorComponent>("WristMenu");
63 WristMenu->SetupAttachment(MotionController);
64
65 //Right now it's implemented in blueprint class
66 /*ThumbSpline = CreateDefaultSubobject<USplineComponent>("ThumbSpline");
67 ThumbSpline->SetupAttachment(HandMesh);
68 IndexSpline = CreateDefaultSubobject<USplineComponent>("IndexSpline");
69 IndexSpline->SetupAttachment(HandMesh);
70 MiddleSpline = CreateDefaultSubobject<USplineComponent>("MiddleSpline");
71 MiddleSpline->SetupAttachment(HandMesh);
72 RingSpline = CreateDefaultSubobject<USplineComponent>("RingSpline");
73 RingSpline->SetupAttachment(HandMesh);
74 PinkySpline = CreateDefaultSubobject<USplineComponent>("PinkySpline");
75 PinkySpline->SetupAttachment(HandMesh);*/
76}
77
78void APixoVRHand::OnObjectOutOfRange(const FBPActorGripInformation& GripInformation, float Distance)
79{
81
82 APixoVRCharacter* PlayerRef = Cast<APixoVRCharacter>(UGameplayStatics::GetPlayerPawn(GetWorld(), 0));
83 if (PlayerRef)
84 {
85 if (HandMotionSource == EControllerHand::Right)
86 {
87 PlayerRef->HoldToolRight = false;
88 }
89 else
90 {
91 PlayerRef->HoldToolLeft = false;
92 }
93 }
94}
95
97{
98 FOverlappingInfo OverlappingInfo;
99 GetOverlappingActor(OverlappingInfo);
100 if (!OverlappingInfo.OverlapActor)
101 {
102 return;
103 }
104
105 FTransform ActorWorldTransformInHand; // World transform for actor to snap to and move relative to hand
106 if (OverlappingInfo.OverlapActor->GetClass()->ImplementsInterface(UPixoVRStoryObject::StaticClass()))
107 ActorWorldTransformInHand = IPixoVRStoryObject::Execute_GetObjectGrabTransform(OverlappingInfo.OverlapActor, this);
108 else
109 ActorWorldTransformInHand = OverlappingInfo.OverlapActor->GetTransform();
110
111 if (OverlappingInfo.OverlapComponent == nullptr)
112 {
113 if (OverlappingInfo.OverlapActor->GetClass()->ImplementsInterface(UPixoVRStoryObject::StaticClass())
114 && IPixoVRStoryObject::Execute_IsGrabbingWrongActorActive(OverlappingInfo.OverlapActor)
115 && (!IPixoVRStoryObject::Execute_IsObjectActive(OverlappingInfo.OverlapActor) || IVRGripInterface::Execute_DenyGripping(OverlappingInfo.OverlapActor, MotionController)))
116 {
117 IPixoVRStoryObject::Execute_SendWrongGrabbingNotification(OverlappingInfo.OverlapActor);
118 return;
119 }
120
121 if (OverlappingInfo.OverlapActor->GetClass()->ImplementsInterface(UPixoVRStoryObject::StaticClass()) && IPixoVRStoryObject::Execute_CouldBeGrabbedByOtherHand(OverlappingInfo.OverlapActor))
123
124 if (MotionController->GripObjectByInterface(OverlappingInfo.OverlapActor, ActorWorldTransformInHand))
125 HandHoldingObject = OverlappingInfo.OverlapActor;
126 }
127 else
128 {
129 MotionController->GripObjectByInterface(OverlappingInfo.OverlapComponent, ActorWorldTransformInHand);
130 HandHoldingObject = OverlappingInfo.OverlapComponent;
131 }
132 //Do we need this ???
133 //ClientSetHoldingActor(HandHoldingObject, EControllerHand::Left);
135}
136
138{
139 UObject* ObjectToDrop = HandHoldingObject;
140 HandHoldingObject = nullptr;
141 MotionController->DropObjectByInterface(ObjectToDrop);
142
143 //Do we need this ???
144 //ClientReleaseHoldingActor(EControllerHand::Left);
145
146 FingerData.Index = 0.0;
147 FingerData.Middle = 0.0;
148 FingerData.Pinky = 0.0;
149 FingerData.Ring = 0.0;
150 FingerData.Thumb = 0.0;
151}
152
154{
155 if (ActorRef)
156 {
157 FTransform ActorWorldTransformInHand; // World transform for actor to snap to and move relative to hand
158 if (ActorRef->GetClass()->ImplementsInterface(UPixoVRStoryObject::StaticClass()))
159 ActorWorldTransformInHand = IPixoVRStoryObject::Execute_GetObjectGrabTransform(ActorRef, this);
160 else
161 ActorWorldTransformInHand = ActorRef->GetTransform();
162
163 if (MotionController->GripObjectByInterface(ActorRef, ActorWorldTransformInHand))
164 GetWorldTimerManager().SetTimerForNextTick([this, ActorRef](){HandHoldingObject = ActorRef;});
165 }
167}
168
169void APixoVRHand::OnTouchWidget(UWidgetComponent* WidgetComponent, UWidgetComponent* PreviousWidgetComponent)
170{
171 if (WidgetComponent && WidgetComponent->GetUserWidgetObject() && !TouchComponentCooldownActive)
172 {
173 TouchComponent->PressPointerKey("LeftMouseButton");
175 FTimerHandle TimerHandle;
176 GetWorld()->GetTimerManager().SetTimer(TimerHandle, this, &APixoVRHand::DeactivateTouchCooldown, 0.2);
177 }
178}
179
181{
182 TouchComponent->ReleasePointerKey("LeftMouseButton");
184}
185
187{
188 if (!HeldActor)
189 {
190 UE_LOG(LogTemp, Error, TEXT("PixoVrHand - ReleaseHeldedObjectOnOtherHand - Actor reference is invalid"));
191 return;
192 }
193 TArray<FBPGripPair> HoldingControllers;
194 bool IsHeld;
195 IVRGripInterface::Execute_IsHeld(HeldActor, HoldingControllers, IsHeld);
196 if (IsHeld)
197 {
198 APixoVRCharacter* PlayerRef = Cast<APixoVRCharacter>(UGameplayStatics::GetPlayerPawn(GetWorld(), 0));
199 APixoVRHand* HandHoldingItem = HandMotionSource == EControllerHand::Right ? PlayerRef->VRHandLeft : PlayerRef->VRHandRight;
200 APixoVRHand* HandHGrabbingItem = HandMotionSource == EControllerHand::Left ? PlayerRef->VRHandLeft : PlayerRef->VRHandRight;
201
202 PlayerRef->HoldToolLeft = false;
203 PlayerRef->HoldToolRight = false;
204
205 HandHGrabbingItem->ReleaseObject();
206
207 if (HandHGrabbingItem->HandMesh->GetAnimInstance()->GetClass()->ImplementsInterface(UHandAnimationInterface::StaticClass()))
208 {
209 IHandAnimationInterface::Execute_SetAnimationGripState(HandHGrabbingItem->HandMesh->GetAnimInstance(), EPixoVRGripState::Open);
210 }
211
212 HandHoldingItem->ReleaseObject();
213
214 // let hand holding item animate to the open pose on release of object
215 if (HandHoldingItem->HandMesh->GetAnimInstance()->GetClass()->ImplementsInterface(UHandAnimationInterface::StaticClass()))
216 {
217 IHandAnimationInterface::Execute_SetAnimationGripState(HandHoldingItem->HandMesh->GetAnimInstance(), EPixoVRGripState::Open);
218 }
219 }
220}
221
222void APixoVRHand::ToggleLaser(bool Visible)
223{
224 LaserMesh->SetVisibility(Visible);
225
226 UGameplayStatics::PlaySound2D(this, LaserSound);
227}
228
229TArray<FVector> APixoVRHand::GetRelativePointsArray(USplineComponent* FingerSpline, float Precision)
230{
231 if (Precision <= 0)
232 {
233 UE_LOG(LogTemp, Error, TEXT("Grab precision can not be less then 1"));
234 return TArray<FVector>();
235 }
236 if (FingerSpline)
237 {
238 float stepSize = FingerSpline->Duration / Precision;
239 TArray<FVector> relativePointsArray;
240 for (int i = 0; i < Precision - 1; i++)
241 {
242 float splineTime = UKismetMathLibrary::FClamp(i * stepSize, 0.0, 1.0);
243 relativePointsArray.Add(UKismetMathLibrary::TransformLocation(
244 FingerSpline->GetRelativeTransform(),
245 FingerSpline->GetLocationAtTime(splineTime, ESplineCoordinateSpace::Local, true)));
246 }
247 return relativePointsArray;
248 }
249 UE_LOG(LogTemp, Error, TEXT("Spline reference is not valid"));
250 return TArray<FVector>();
251}
252
253float APixoVRHand::TraceFingerForObstacle(TArray<FVector> RelativePointsArray)
254{
255 FVector splinePointLocation;
256 FVector nextSplinePointLocation;
257 float hitLenght = 0;
258 float totalLenght = 0;
259 bool didHit = false;
260 FHitResult hitResult;
261 TArray<TEnumAsByte<EObjectTypeQuery>> traceObjectTypes;
262 traceObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECC_WorldStatic));
263 traceObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECC_WorldDynamic));
264 traceObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECC_PhysicsBody));
265 FCollisionQueryParams queryParams;
266 queryParams.AddIgnoredActor(this);
267
268 for (int i = 0; i < RelativePointsArray.Num() - 2; i++)
269 {
270 splinePointLocation = UKismetMathLibrary::TransformLocation(HandMesh->GetComponentTransform(),
271 RelativePointsArray[i]);
272 nextSplinePointLocation = UKismetMathLibrary::TransformLocation(HandMesh->GetComponentTransform(),
273 RelativePointsArray[i + 1]);
274
275 //Trace grabbed Component for Finger Positioning
276 if (!didHit)
277 {
278 bool didTraceHit = GetWorld()->LineTraceSingleByObjectType(hitResult, splinePointLocation,
279 nextSplinePointLocation, traceObjectTypes,
280 queryParams);
281 if (didTraceHit)
282 {
283 didHit = true;
284 hitLenght = totalLenght + hitResult.Distance;
285 }
286 }
287 //Calculate Total Length of the Trace and update Hit Length if necessary
288 totalLenght = totalLenght + UKismetMathLibrary::Vector_Distance(splinePointLocation, nextSplinePointLocation);
289 if (!didHit)
290 {
291 hitLenght = totalLenght;
292 }
293 }
294 return UKismetMathLibrary::FClamp(hitLenght / totalLenght, 0.0, 1.0);
295}
296
306
315
316// Called when the game starts or when spawned
318{
319 Super::BeginPlay();
320
321 //Can be used when init of splines would be in c++
322 //SetupFingerTracePoints();
324}
325
327{
328 IsWristMenuEnabled = Enabled;
329 WristMenu->SetVisibility(Enabled);
330}
331
332// Called every frame
333void APixoVRHand::Tick(float DeltaTime)
334{
335 Super::Tick(DeltaTime);
336
337 auto IsObjectHasGripType = [](const FOverlappingInfo &OverlapInfo, const EGrippableTypeChecker &GripTypeChecker)->bool
338 {
339 switch (GripTypeChecker)
340 {
342 return true;
344 if (OverlapInfo.OverlapActor->GetClass()->ImplementsInterface(UPixoVRStoryObject::StaticClass()))
345 {
346 return IPixoVRStoryObject::Execute_IsObjectActive(OverlapInfo.OverlapActor)
347 || IPixoVRStoryObject::Execute_IsGrabbingWrongActorActive(OverlapInfo.OverlapActor);
348 }
349
350 return false;
352 return OverlapInfo.OverlapActor->GetClass()->ImplementsInterface(UPixoVRStoryObject::StaticClass());
354 return OverlapInfo.OverlapActor->GetClass()->ImplementsInterface(UVRGripInterface::StaticClass());
355 default:
356 return false;
357 }
358 };
359
360 // Activation logic when hand approaches to interactable object hand animation changing and object is highlighting
362 {
363 if (HandHoldingObject == nullptr)
364 {
365 FOverlappingInfo OverlapInfo;
366 GetOverlappingActor(OverlapInfo);
367 if (OverlapInfo.OverlapActor)
368 {
369 if (OverlapedActor != OverlapInfo.OverlapActor)
370 {
372 IHandAnimationInterface::Execute_SetAnimationGripState(HandMesh->GetAnimInstance(), EPixoVRGripState::Open);
374 {
375 if (OverlapedActor->GetClass()->ImplementsInterface(UPixoVRStoryObject::StaticClass()))
376 {
377 IPixoVRStoryObject::Execute_UpdateObjectHighlight(OverlapedActor, false);
378 }
379 }
380 }
381 if (IsObjectHasGripType(OverlapInfo, GrippableTypeChecker) && !InteractableObjectNearHand)
382 {
383 IHandAnimationInterface::Execute_SetAnimationGripState(HandMesh->GetAnimInstance(), EPixoVRGripState::CanGrab);
385 OverlapedActor = OverlapInfo.OverlapActor;
387 {
388 if (OverlapedActor->GetClass()->ImplementsInterface(UPixoVRStoryObject::StaticClass()))
389 {
390 IPixoVRStoryObject::Execute_UpdateObjectHighlight(OverlapedActor, true);
391 }
392 }
393 }
394 }
395 else
396 {
398 {
399 IHandAnimationInterface::Execute_SetAnimationGripState(HandMesh->GetAnimInstance(), EPixoVRGripState::Open);
402 {
403 if (OverlapedActor->GetClass()->ImplementsInterface(UPixoVRStoryObject::StaticClass()))
404 {
405 IPixoVRStoryObject::Execute_UpdateObjectHighlight(OverlapedActor, false);
406 }
407 }
408 }
409 }
410 }
412 {
413 if (OverlapedActor->GetClass()->ImplementsInterface(UPixoVRStoryObject::StaticClass()))
414 {
415 IPixoVRStoryObject::Execute_UpdateObjectHighlight(OverlapedActor, false);
416 }
417
418 OverlapedActor = nullptr;
419 }
420 }
421}
422
423void APixoVRHand::InitPixoVRHands(EControllerHand MotionSource, APixoVRCharacter* Character)
424{
425 OwningCharacter = Character;
426
427 HandMotionSource = MotionSource;
428 switch (MotionSource)
429 {
430 case EControllerHand::Left:
431 MotionController->SetTrackingMotionSource(FXRMotionControllerBase::LeftHandSourceId);
432 HandMesh->SetRelativeScale3D(FVector(1.0, 1.0, -1.0));
433 GrabSphere->SetRelativeLocation(GrabSphere->GetRelativeLocation() * FVector(1.f, -1.f, 1.f));
434 TouchComponent->PointerIndex = 0;
435 break;
436 case EControllerHand::Right:
437 MotionController->SetTrackingMotionSource(FXRMotionControllerBase::RightHandSourceId);
438 TouchComponent->PointerIndex = 1;
439 break;
440 default:
441 UE_LOG(LogTemp, Error, TEXT("Hand motion source is undefined!"));
442 break;
443 }
444
445 MotionController->bOffsetByHMD = false;
446 // Keep the controllers ticking after movement
447 /*MotionController->AddTickPrerequisiteComponent(OwningCharacter->GetCharacterMovement());
448 MotionController->OverrideSendTransform = &AVRBaseCharacter::Server_SendTransformLeftController;*/
449
450 if (HandMesh->GetAnimInstance()->GetClass()->ImplementsInterface(UHandAnimationInterface::StaticClass()))
451 {
452 IHandAnimationInterface::Execute_SetHandActor(HandMesh->GetAnimInstance(), this);
453 }
454 else
455 UE_LOG(LogTemp, Error, TEXT("Animation blueprint does not implement PixoVRGripInterface"));
456}
457
458void APixoVRHand::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
459{
460 Super::GetLifetimeReplicatedProps(OutLifetimeProps);
461
462 DOREPLIFETIME(APixoVRHand, HandHoldingObject);
463 DOREPLIFETIME(APixoVRHand, FingerData);
464}
465
467{
468 // If we hold already something on this hand, don't check for anything else.
469 if (HandHoldingObject != nullptr)
470 {
471 return;
472 }
473
474 TArray<TEnumAsByte<EObjectTypeQuery>> ObjectTypes;
475 ObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECC_WorldDynamic));
476 ObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECC_PhysicsBody));
477 ObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECC_WorldStatic));
478 auto TraceComplex = false;
479 TArray<AActor*> ActorsToIgnore;
480 auto IgnoreSelf = true;
481 TArray<FHitResult> HitResults;
482
483 // TODO Because 4.22 has issues (returning always false) when Start and End vector are the same
484 // an offset is used.
485 bool Hit = UKismetSystemLibrary::SphereTraceMultiForObjects(GetWorld(),
486 GrabSphere->GetComponentLocation(),
487 GrabSphere->GetComponentLocation() + (GrabSphere->
488 GetForwardVector() * 0.01),
489 GrabSphere->GetUnscaledSphereRadius(),
490 ObjectTypes,
491 TraceComplex,
492 ActorsToIgnore,
493 EDrawDebugTrace::None,
494 HitResults,
495 IgnoreSelf);
496
497
498 if (Hit)
499 {
500 for (const auto& HitResult : HitResults)
501 {
502 // Does the actor support our grip interface?
503 if (HitResult.Actor->GetClass()->ImplementsInterface(UVRGripInterface::StaticClass()))
504 {
505 OverlappingInfo.OverlapActor = HitResult.Actor.Get();
506
507 if (HitResult.Component->GetClass()->ImplementsInterface(UVRGripInterface::StaticClass()))
508 {
509 OverlappingInfo.OverlapComponent = HitResult.Component.Get();
510 }
511
512 // Do we have a collision with a socket?
513 if (HitResult.BoneName != NAME_None)
514 {
515 OverlappingInfo.Socket = HitResult.BoneName;
516 }
517
518 if (OverlappingInfo.OverlapActor && !IVRGripInterface::Execute_DenyGripping(OverlappingInfo.OverlapActor,MotionController))
519 {
520 break;
521 }
522 }
523 }
524 }
525}
EGrippableTypeChecker
EGrippableTypeChecker is an enumeration that represents what type of objects we can grip.
Definition PixoVRHand.h:85
Pixo VR Character This class represents the main character in the Pixo VR game. It extends the AVRCha...
APixoVRHand * VRHandLeft
UPROPERTY(BlueprintReadOnly, Category = "Hands")
APixoVRHand * VRHandRight
UPROPERTY(BlueprintReadOnly, Category = "Hands")
APixoVRHand is an actor class that represents a hand in the VR environment.
Definition PixoVRHand.h:99
void SetupFingerTracePoints()
Sets up the cache of relative points for finger tracing. This function should be called during initia...
float TraceFingerForObstacle(TArray< FVector > RelativePointsArray)
Traces the finger along the given array of relative points to check for obstacles.
TArray< FVector > ThumbPositionCache
Definition PixoVRHand.h:345
void UpdateFingerData()
Updates the finger data by tracing each finger for obstacles and storing the normalized obstacle dist...
UWidgetInteractionComponent * TouchComponent
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:172
bool TouchComponentCooldownActive
Definition PixoVRHand.h:360
void ManuallyPutActorToHand(AActor *ActorRef)
Manually puts an actor into the hand. Hand will try to grab this actor.
FFingerData FingerData
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "Animation")
Definition PixoVRHand.h:304
bool ChangeHandAnimationNearInteractableObject
UPROPERTY(EditDefaultsOnly, Category = "Animation")
Definition PixoVRHand.h:325
void DeactivateTouchCooldown()
Deactivates the touch cooldown of the hand.
bool InteractableObjectNearHand
Definition PixoVRHand.h:342
UStaticMeshComponent * LaserMesh
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:136
USkeletalMeshComponent * HandMesh
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:130
bool IsWristMenuEnabled
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:185
void GrabObject()
Grabs the object currently overlapped by grab sphere.
APixoVRCharacter * OwningCharacter
UPROPERTY(BlueprintReadWrite, Category = "Init")
Definition PixoVRHand.h:389
USplineComponent * RingSpline
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:160
bool IsObjectHighlightActive
Show highlight if hand near object that we can grab.
Definition PixoVRHand.h:341
USplineComponent * PinkySpline
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:166
TArray< FVector > GetRelativePointsArray(USplineComponent *FingerSpline, float Precision)
Retrieves an array of relative points along the finger spline.
TArray< FVector > MiddlePositionCache
Definition PixoVRHand.h:347
void InitPixoVRHands(EControllerHand MotionSource, APixoVRCharacter *Character)
UGripMotionControllerComponent * MotionController
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:118
virtual void BeginPlay() override
USphereComponent * GrabSphere
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:124
virtual void Tick(float DeltaTime) override
void ReleaseHeldObjectOnOtherHand(AActor *HeldActor)
Releases the held object on the other hand.
USplineComponent * MiddleSpline
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:154
void SetWristMenuEnabled(bool Enabled)
Enables or disables wrist menu.
USceneComponent * Root
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:112
void GetOverlappingActor(FOverlappingInfo &OverlappingInfo)
Gets the info of actor currently overlapping with the grab sphere.
EGrippableTypeChecker GrippableTypeChecker
Flag that indicated near which objects should we change animation.
Definition PixoVRHand.h:333
void ReleaseObject()
Releases the currently held object.
USplineComponent * ThumbSpline
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:142
TArray< FVector > PinkyPositionCache
Definition PixoVRHand.h:349
EControllerHand HandMotionSource
UPROPERTY(BlueprintReadWrite, Category = "Init", meta = (ExposeOnSpawn = "true"))
Definition PixoVRHand.h:383
void OnObjectOutOfRange(const FBPActorGripInformation &GripInformation, float Distance)
Handling case when object physical constraint has been broken by range.
USplineComponent * IndexSpline
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:148
TArray< FVector > IndexPositionCache
Definition PixoVRHand.h:346
UObject * HandHoldingObject
UPROPERTY(BlueprintReadOnly, Replicated, Category = "PixoVR")
Definition PixoVRHand.h:250
AActor * OverlapedActor
Definition PixoVRHand.h:343
void OnTouchWidget(UWidgetComponent *WidgetComponent, UWidgetComponent *PreviousWidgetComponent)
Called when the hand touches a widget component.
void ToggleLaser(bool Visible)
Toggles the visibility of the laser.
USoundCue * LaserSound
UPROPERTY()
Definition PixoVRHand.h:264
UChildActorComponent * WristMenu
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
Definition PixoVRHand.h:178
TArray< FVector > RingPositionCache
Definition PixoVRHand.h:348
float Middle
UPROPERTY(EditAnywhere, BlueprintReadWrite)
Definition PixoVRHand.h:62
float Pinky
UPROPERTY(EditAnywhere, BlueprintReadWrite)
Definition PixoVRHand.h:74
float Index
UPROPERTY(EditAnywhere, BlueprintReadWrite)
Definition PixoVRHand.h:56
float Ring
UPROPERTY(EditAnywhere, BlueprintReadWrite)
Definition PixoVRHand.h:68
float Thumb
UPROPERTY(EditAnywhere, BlueprintReadWrite)
Definition PixoVRHand.h:50
FOverlappingInfo is a structure that holds information about overlapping actors and components.
Definition PixoVRHand.h:22
AActor * OverlapActor
Definition PixoVRHand.h:29
UPrimitiveComponent * OverlapComponent
Definition PixoVRHand.h:30