diff --git a/RoomEscape/Source/RoomEscape/Grabber.cpp b/RoomEscape/Source/RoomEscape/Grabber.cpp index cf1f051..4aa0ea4 100644 --- a/RoomEscape/Source/RoomEscape/Grabber.cpp +++ b/RoomEscape/Source/RoomEscape/Grabber.cpp @@ -38,6 +38,7 @@ void UGrabber::BeginPlay() UE_LOG(LogTemp, Warning, TEXT("%s has a InputHandle"), *(GetOwner()->GetName())); InputComponent->BindAction("Grab", IE_Pressed, this, &UGrabber::Grab); + InputComponent->BindAction("Grab", IE_Released, this, &UGrabber::Release); } else { UE_LOG(LogTemp, Error, TEXT("%s has no InputHandle"), *(GetOwner()->GetName())); @@ -46,9 +47,12 @@ void UGrabber::BeginPlay() } // Raycast and grab what is in reach -void UGrabber::Grab(){ +void UGrabber::Grab() { UE_LOG(LogTemp, Warning, TEXT("GRABBING!")); } +void UGrabber::Release() { + UE_LOG(LogTemp, Warning, TEXT("Released!")); +} // Called every frame diff --git a/RoomEscape/Source/RoomEscape/Grabber.h b/RoomEscape/Source/RoomEscape/Grabber.h index a2aacd5..d588c28 100644 --- a/RoomEscape/Source/RoomEscape/Grabber.h +++ b/RoomEscape/Source/RoomEscape/Grabber.h @@ -27,4 +27,5 @@ private: UPhysicsHandleComponent* PhysicsHandle = nullptr; UInputComponent* InputComponent = nullptr; void Grab(); // Raycast and grab what is in reach + void Release(); // Raycast and grab what is in reach };