Skip to content

Commit

Permalink
BE28 Using FindComponentByClass()
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Tristem committed Mar 10, 2016
1 parent da34a15 commit e3f486c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
Binary file modified BuildingEscape/Content/DefaultPawn_BP.uasset
Binary file not shown.
Binary file modified BuildingEscape/Content/NewMap.umap
Binary file not shown.
10 changes: 10 additions & 0 deletions BuildingEscape/Source/BuildingEscape/Grabber.cpp
Expand Up @@ -23,6 +23,16 @@ void UGrabber::BeginPlay()
Super::BeginPlay();
UE_LOG(LogTemp, Warning, TEXT("Grabber reporting for duty!"));

/// Look for attached Physics Handle
PhysicsHandle = GetOwner()->FindComponentByClass<UPhysicsHandleComponent>();
if (PhysicsHandle)
{
// Physics handle is found
}
else
{
UE_LOG(LogTemp, Error, TEXT("%s missing physics handle component"), *GetOwner()->GetName())
}
}


Expand Down
3 changes: 3 additions & 0 deletions BuildingEscape/Source/BuildingEscape/Grabber.h
Expand Up @@ -21,7 +21,10 @@ class BUILDINGESCAPE_API UGrabber : public UActorComponent
// Called every frame
virtual void TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction ) override;


private:
// How far ahead of the player can we reach in cm
float Reach = 100.f;

UPhysicsHandleComponent* PhysicsHandle = nullptr;
};

0 comments on commit e3f486c

Please sign in to comment.