Skip to content
Snippets Groups Projects
Commit df6c21b3 authored by Sebastian Pape's avatar Sebastian Pape
Browse files

Basic refactoring in BasicVRInteractionComponent

parent 59f4ecae
No related branches found
No related tags found
No related merge requests found
......@@ -38,6 +38,7 @@ void UBasicVRInteractionComponent::BeginInteraction()
AActor* HitActor = Hit.GetActor();
// try to cast HitActor int a Grabable if not succeeded will become a nullptr
IGrabable* GrabableActor = Cast<IGrabable>(HitActor);
IClickable* ClickableActor = Cast<IClickable>(HitActor);
......@@ -73,13 +74,10 @@ void UBasicVRInteractionComponent::EndInteraction()
Cast<IGrabable>(GrabbedActor)->OnReleased_Implementation();
// Detach the Actor
UPrimitiveComponent* PhysicsComp = GrabbedActor->FindComponentByClass<UPrimitiveComponent>();
UGrabbingBehaviorComponent* Behavior = GrabbedActor->FindComponentByClass<UGrabbingBehaviorComponent>();
if (Behavior == nullptr)
if (GrabbedActor->FindComponentByClass<UGrabbingBehaviorComponent>() == nullptr)
{
GrabbedActor->GetRootComponent()->DetachFromComponent(FDetachmentTransformRules::KeepWorldTransform);
PhysicsComp->SetSimulatePhysics(bDidSimulatePhysics);
GrabbedActor->FindComponentByClass<UPrimitiveComponent>()->SetSimulatePhysics(bDidSimulatePhysics);
}
// forget about the actor
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment