Skip to content
Snippets Groups Projects
Commit 7f1add7e authored by Kamil Karwacki's avatar Kamil Karwacki
Browse files

Grabbing behavior saved as variable and comment typo changed

parent 8aedc6f5
No related branches found
No related tags found
1 merge request!28Feature/vr pawn426
......@@ -47,8 +47,8 @@ void UBasicVRInteractionComponent::BeginInteraction()
// call grabable actors function so he reacts to our grab
GrabableActor->OnGrabbed_Implementation();
UGrabbingBehaviorComponent* Behavior = HitActor->FindComponentByClass<UGrabbingBehaviorComponent>();
// save it for later, is needed every tick
Behavior = HitActor->FindComponentByClass<UGrabbingBehaviorComponent>();
if ( Behavior == nullptr)
HandlePhysicsAndAttachActor(HitActor);
......@@ -82,6 +82,7 @@ void UBasicVRInteractionComponent::EndInteraction()
// forget about the actor
GrabbedActor = nullptr;
Behavior = nullptr;
}
// Called every frame
......@@ -92,7 +93,7 @@ void UBasicVRInteractionComponent::TickComponent(float DeltaTime, ELevelTick Tic
// if an actor is grabbed and a behavior is defined move move him accordingly
if (GrabbedActor == nullptr || InteractionRayEmitter == nullptr) return;
UGrabbingBehaviorComponent* Behavior = GrabbedActor->FindComponentByClass<UGrabbingBehaviorComponent>();
//UGrabbingBehaviorComponent* Behavior = GrabbedActor->FindComponentByClass<UGrabbingBehaviorComponent>();
// if our Grabable Actor is not constrained
if (Behavior != nullptr)
......
......@@ -6,6 +6,8 @@
#include "Components/ActorComponent.h"
#include "BasicVRInteractionComponent.generated.h"
class UGrabbingBehaviorComponent;
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class DISPLAYCLUSTEREXTENSIONS_API UBasicVRInteractionComponent : public UActorComponent
......@@ -34,6 +36,7 @@ private:
UPROPERTY() bool bDidSimulatePhysics;
/* Holding a reference to the actor that is currently being grabbed */
UPROPERTY() AActor* GrabbedActor;
UPROPERTY() UGrabbingBehaviorComponent* Behavior = nullptr;
UPROPERTY() USceneComponent* InteractionRayEmitter = nullptr;
void HandlePhysicsAndAttachActor(AActor* HitActor);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment