Add `NakatomiFieldSystemActor`
This commit is contained in:
parent
cb969be97c
commit
934055d0ed
|
@ -0,0 +1,28 @@
|
||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "NakatomiFieldSystemActor.h"
|
||||||
|
|
||||||
|
ANakatomiFieldSystemActor::ANakatomiFieldSystemActor()
|
||||||
|
{
|
||||||
|
SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComponent"));
|
||||||
|
SphereComponent->SetSphereRadius(25.0f, true);
|
||||||
|
SphereComponent->SetCollisionEnabled(ECollisionEnabled::QueryAndProbe);
|
||||||
|
|
||||||
|
SphereComponent->SetupAttachment(RootComponent);
|
||||||
|
RadialFalloff = CreateDefaultSubobject<URadialFalloff>(TEXT("Radial Falloff"));
|
||||||
|
RadialVector = CreateDefaultSubobject<URadialVector>(TEXT("Radial Vector"));
|
||||||
|
CullingField = CreateDefaultSubobject<UCullingField>(TEXT("Culling Field"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ANakatomiFieldSystemActor::BeginPlay()
|
||||||
|
{
|
||||||
|
Radius = SphereComponent->GetScaledSphereRadius();
|
||||||
|
Position = GetActorLocation();
|
||||||
|
RadialFalloff = RadialFalloff->SetRadialFalloff(StrainMagnitude, MinRange, MaxRange, Default, Radius, Position, EFieldFalloffType::Field_FallOff_None);
|
||||||
|
GetFieldSystemComponent()->ApplyPhysicsField(true, Field_ExternalClusterStrain, nullptr, RadialFalloff);
|
||||||
|
|
||||||
|
RadialVector = RadialVector->SetRadialVector(ForceMagnitude, Position);
|
||||||
|
CullingField = CullingField->SetCullingField(RadialFalloff, RadialVector, Field_Culling_Outside);
|
||||||
|
GetFieldSystemComponent()->ApplyPhysicsField(true, Field_LinearVelocity, nullptr, CullingField);
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "Components/SphereComponent.h"
|
||||||
|
#include "Field/FieldSystemActor.h"
|
||||||
|
#include "NakatomiFieldSystemActor.generated.h"
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class NAKATOMI_API ANakatomiFieldSystemActor : public AFieldSystemActor
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
USphereComponent* SphereComponent;
|
||||||
|
|
||||||
|
URadialFalloff* RadialFalloff;
|
||||||
|
|
||||||
|
URadialVector* RadialVector;
|
||||||
|
|
||||||
|
UCullingField* CullingField;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Radial Falloff", Meta = (AllowPrivateAccess = "true"))
|
||||||
|
float StrainMagnitude = 500.0f;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Radial Vector", Meta = (AllowPrivateAccess = "true"))
|
||||||
|
float ForceMagnitude = 500.0f;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Radial Falloff", Meta = (AllowPrivateAccess = "true"))
|
||||||
|
float MinRange = 0.0f;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Radial Falloff", Meta = (AllowPrivateAccess = "true"))
|
||||||
|
float MaxRange = 1.0f;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Radial Falloff", Meta = (AllowPrivateAccess = "true"))
|
||||||
|
float Default = 0.0f;
|
||||||
|
|
||||||
|
UPROPERTY(VisibleAnywhere, Category = "Radial Falloff", Meta = (AllowPrivateAccess = "true"))
|
||||||
|
float Radius = 0.0f;
|
||||||
|
|
||||||
|
UPROPERTY(VisibleAnywhere, Category = "Radial Falloff", Meta = (AllowPrivateAccess = "true"))
|
||||||
|
FVector Position = FVector::ZeroVector;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
ANakatomiFieldSystemActor();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Called when the game starts or when spawned
|
||||||
|
virtual void BeginPlay() override;
|
||||||
|
};
|
Loading…
Reference in New Issue