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"

Custom Distribution Vector GetValue Override problem

hello, Im creating a custom distribution vector parameter based on "UDistributionVectorConstantCurve" for a Particle system.

I already implemented one based on "UDistributionVectorConstant" without any major problem.

however when Implementing this , the override of the function GetValue comes with all the parameters as null and therefore I cant manipulate the data.

Any clues of what Im doing wrong? or am I missing something?

here`s the code DistributionCurveParameter.h:

 // Fill out your copyright notice in the Description page of Project Settings.
 
 #pragma once
 
 #include "CoreMinimal.h"
 #include "Distributions/DistributionVectorConstantCurve.h"
 #include "DistributionCurveParameter.generated.h"
 
 /**
  * 
  */
 UCLASS()
 class RAILTEST_API UDistributionCurveParameter : public UDistributionVectorConstantCurve
 {
     GENERATED_BODY()
     UDistributionCurveParameter();
     UPROPERTY(EditAnywhere)
     float numPointsParam;
     UPROPERTY(EditAnywhere)
       int numKeysCreated;
     UPROPERTY(EditAnywhere)
         int numSubCurves;
     UPROPERTY(EditAnywhere)
     FName numPiointsName;
     
      
     virtual bool    IsPostLoadThreadSafe() const override;
      
     virtual FVector    GetValue(float F = 0.f, UObject* Data = NULL, int32 LastExtreme = 0, struct FRandomStream* InRandomStream = NULL) const override;
     
     private:
      bool GetParamValue(UObject* Data, FName ParamName, float& OutVector) const;
 
 };


DistributionCurveParameter.cpp:

 // Fill out your copyright notice in the Description page of Project Settings.
 #include "../Public/DistributionCurveParameter.h"
 
 #include "Particles/ParticleSystemComponent.h"
 
 
 UDistributionCurveParameter::UDistributionCurveParameter()
 {
     numPiointsName = "numPoints";
     numPointsParam=GetParamValue(this,numPiointsName,numPointsParam);
     
      
     numSubCurves = GetNumSubCurves();
 }
 bool UDistributionCurveParameter::IsPostLoadThreadSafe() const
 {
     return true;
 }
 
  
 
 FVector UDistributionCurveParameter::GetValue(float F, UObject * Data, int32 LastExtreme, FRandomStream * InRandomStream) const
 {
     if (!Data)
         return FVector(0, 0, 0);
     else
         return FVector(0, -555, -999);
  
 
 }
  
 bool UDistributionCurveParameter::GetParamValue(UObject * Data, FName ParamName, float & OutVector) const
 {
     bool bFoundParam = false;
 
     UParticleSystemComponent* ParticleComp = Cast<UParticleSystemComponent>(Data);
     if (ParticleComp)
     {
         bFoundParam = ParticleComp->GetFloatParameter(ParamName, OutVector);
     }
     return bFoundParam;
      
 }
  
 


Product Version: UE 4.21
Tags:
more ▼

asked Jun 17 '19 at 01:23 PM in C++ Programming

avatar image

Pedorero1
1

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

0 answers: sort voted first
Be the first one to answer this question
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