Hello! This is just a question I have for how UE works. I’ve looked around a lot, and while I seem to find plenty of answers of how to have a player act through some type of Actor in the game, I cannot quite figure how an AI does the same. Questions:
What is the relationship between a Pawn, a Movement Component and a Controller; which class communicates what to whom? Sorry if I’m coming off a little dense, I just cannot get a grip on what goes where.
More sepcific to my case, I have created a Pawn class and am creating a movement component for it, deriving from PawnMovementComponent. This is the overriding Tick function.
void UTurnBasedMovementComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* TurnBasedTickFunction)
{
Super::TickComponent(DeltaTime, TickType, TurnBasedTickFunction);
if (!PawnOwner || !UpdatedComponent || ShouldSkipUpdate(DeltaTime))
{
return;
}
FVector TargetMoveToThisFrame = ConsumeInputVector() * DeltaTime * 150.0f;
if (!TargetMoveToThisFrame.IsNearlyZero())
{
FHitResult Hit;
SafeMoveUpdatedComponent(TargetMoveToThisFrame, UpdatedComponent->GetComponentRotation(), true, Hit);
}
}
Will an AIController be able to utilize the same movement component when it possesses the pawn? Will it somehow pass a Vector argument and move the pawn as though it was a player, or is that not how it works?
Apologies in advance if this is not the right section for this, but I will be very grateful for any explanation just the same.
Thank you!