x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Problem getting PointLight AttentuationRadius

I'm having a problem accessing a point lights attentuation radius. Right now my tick method in my cpp file is as follows

 void AASCharacter::Tick(float DeltaTime)
 {
     Super::Tick(DeltaTime);
 
     TArray<AActor*> PointLights;
     UGameplayStatics::GetAllActorsOfClass(this, APointLight::StaticClass(), PointLights);
 
     for (int32 i = 0; i < PointLights.Num(); i++)
     {
         APointLight* Light = Cast<APointLight>(PointLights[i]);
 
         if (Light)
         {
             FVector EyeLocation;
             FRotator EyesRoation;
 
             GetActorEyesViewPoint(EyeLocation, EyesRoation);
     
             float Distance = (Light->GetActorLocation() - EyeLocation).Size();
             if (Distance > Light->PointLightComponent->AttenuationRadius)
             {
 
             }
         }
     }
 
 }

My header file is:

 #pragma once
 
 #include "Engine/PointLight.h"
 #include "Engine/Light.h"
 #include "Components/LightComponent.h"
 #include "Kismet/GameplayStatics.h"
 #include "CoreMinimal.h"
 #include "GameFramework/Character.h"
 #include "ASCharacter.generated.h"
 
 UCLASS()
 class ESCAPEROOM_API AASCharacter : public ACharacter
 {
     GENERATED_BODY()
 
 public:
     // Sets default values for this character's properties
     AASCharacter();
 
 protected:
     // Called when the game starts or when spawned
     virtual void BeginPlay() override;
 
 public:    
     // Called every frame
     virtual void Tick(float DeltaTime) override;
 
     // Called to bind functionality to input
     virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
 
     
     
 };

However, I'm having problems with the following line of code: Light->PointLightComponent->AttenuationRadius

In my editor it is telling me I don't have access to an incomplete class. I have a feeling that this is down to a missing header file but I don't know which header to include. Could someone please tell me what I should do? 

Product Version: UE 4.18
Tags:
more ▼

asked Jan 18 '18 at 11:24 AM in C++ Programming

avatar image

Ninetails
3 1 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hey there, try including the PointLightComponent.h

more ▼

answered Jan 18 '18 at 12:13 PM

avatar image

xlar8or
6k 163 129 305

avatar image Ninetails Jan 18 '18 at 01:26 PM

Just the #include "PointLightComponent.h" its not in any subfolder? I spent over an hour trying to find it last night and nothing popped up.

avatar image xlar8or Jan 18 '18 at 02:38 PM
 #include "Components/PointLightComponent.h"
avatar image Ninetails Jan 18 '18 at 02:43 PM

Thank you so much!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question