Skip to content
Snippets Groups Projects
Commit f13b026f authored by David Gilbert's avatar David Gilbert :bug:
Browse files

refactor(Interaction): Moves IgnoreActors array to member variable, allocates...

refactor(Interaction): Moves IgnoreActors array to member variable, allocates now only once instead of on tick.
parent 2276f943
No related branches found
No related tags found
No related merge requests found
......@@ -17,7 +17,6 @@ UGrabComponent::UGrabComponent()
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these
// features off to improve performance if you don't need them.
PrimaryComponentTick.bCanEverTick = true;
// ...
}
......@@ -27,8 +26,6 @@ void UGrabComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorC
TArray<UInteractableComponent*> CurrentGrabCompsInRange;
TArray<AActor*> ActorsToIgnore;
ActorsToIgnore.Add(GetOwner());
TArray<FHitResult> OutHits;
const ETraceTypeQuery TraceType = UEngineTypes::ConvertToTraceType(ECollisionChannel::ECC_PhysicsBody);
......@@ -90,6 +87,9 @@ void UGrabComponent::SetupPlayerInput(UInputComponent* PlayerInputComponent)
if (!Pawn)
return;
// Probably not the best place to add this.
ActorsToIgnore.AddUnique(GetOwner());
UEnhancedInputComponent* EI = Cast<UEnhancedInputComponent>(Pawn->InputComponent);
if (EI == nullptr)
return;
......
......@@ -34,6 +34,9 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Grabbing")
bool bOnlyGrabClosestActor = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Grabbing")
TArray<AActor*> ActorsToIgnore;
virtual void SetupPlayerInput(UInputComponent* PlayerInputComponent) override;
private:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment