



SplineComponent가 BP_Tentacle 안에 있는 친구다 보니깐 같이 이동되면서 이상하게 이동 됌.
그래서 SplineComponent를 가지는 AActor를 만들어서 맵에 배치하는 식으로 하는게 좋을 것 같다고 생각이됌….
// ASplinePathActor.h
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "SplinePathActor.generated.h"
class USplineComponent;
UCLASS()
class YOURGAME_API ASplinePathActor : public AActor
{
GENERATED_BODY()
public:
ASplinePathActor();
UFUNCTION(BlueprintCallable)
USplineComponent* GetSplineComponent() const { return Spline; }
protected:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
TObjectPtr<USplineComponent> Spline;
};
FVector AMonster::GetPatrolLocation(int32 Index) const
{
if (AssignedSplineActor)
{
USplineComponent* PatrolSpline = AssignedSplineActor->GetSplineComponent();
if (!PatrolSpline || PatrolSpline->GetNumberOfSplinePoints() == 0) return GetActorLocation();
// Get SplinePoint to World Location
FVector Location = PatrolSpline->GetLocationAtSplinePoint(Index, ESplineCoordinateSpace::World);
return Location;
}
else
{
LOG(TEXT("SplineActor is not Assigned."));
return FVector::ZeroVector;
}
}
int32 AMonster::GetNextPatrolIndex(int32 CurrentIndex) const
{
if (AssignedSplineActor)
{
USplineComponent* PatrolSpline = AssignedSplineActor->GetSplineComponent();
CurrentIndex = (CurrentIndex + 1) % PatrolSpline->GetNumberOfSplinePoints(); // Cycle
LOG(TEXT("PatrolIndex increment : %d"), CurrentIndex);
return CurrentIndex;
}
else
{
LOG(TEXT("SplineActor is not Assigned."));
return -1;
}
}
해결 완료

void AMonsterAIController::LoadSightDataFromTable()
{
if (SightDataTable == nullptr)
{
LOG(TEXT("SightDataTable is not assigned"));
return;
}
LOG(TEXT("Loading sight data for MonsterID = %s"), *MonsterID.ToString());
// Setting up visual information data import from a data table
const FMonsterSightData* SightRow = SightDataTable->FindRow<FMonsterSightData>(MonsterID, TEXT("MonsterSight"));
if (SightRow && SightConfig)
{
SightConfig->SightRadius = SightRow->SightRadius;
SightConfig->LoseSightRadius = SightRow->LoseSightRadius;
SightConfig->PeripheralVisionAngleDegrees = SightRow->PeripheralVisionAngleDegrees;
SightConfig->SetMaxAge(SightRow->SenseInterval);
}
else
{
LOG(TEXT("No matching row found for MonsterID"));
}
}