Files
ProjectEleri/Source/ProjectEleri/GameObjects/EleriStandPoint.h

39 lines
2.2 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
class AActor;
/**
* Where an NPC should stand when a schedule sends it at an actor.
*
* A schedule names the furniture an NPC is meant to use, and the useful place to stand is almost never
* the furniture's own origin. A bench, a bed, a counter: each one carves the navmesh away underneath
* itself, so its origin sits over that hole rather than over floor, and a walk aimed at it is a walk to
* a point no polygon covers. The engine will not project such a destination onto the mesh from further
* away than its own 50 uu window, which is narrower than most of this furniture is wide, so the walk is
* refused outright and the NPC never leaves where it stands.
*
* The place to stand is therefore authored, see AEleriBaseActor::StandPoint, and this is where the
* schedule reads it. It lives in a helper rather than at either reader because there are two of them:
* FResolvedNpcAction::GetAnchorTransform answers for an anchor the caller can see, and
* UScheduleSubsystem::ResolveAction remembers the answer for one that has streamed out. A rule written
* twice is a rule that can come out differently, and an anchor that is walked to one way while it is
* loaded and another way once it comes back is exactly the fault this is here to prevent.
*/
namespace EleriStandPoint
{
/** Where to stand for Anchor: its authored stand point when it has one, and its own transform when
* it does not, which is every anchor that is not furniture. An actor with no stand point of its own
* is an anchor all the same, and is answered for by its transform exactly as it was before stand
* points existed. A null anchor answers with the identity transform, an unset place to be, which is
* what a caller with no actor has; every caller here has already established that its anchor exists.
*
* A pure read, deliberately: nothing is cached and nothing is written back to the anchor, so a bed
* whose stand point arrow is moved while an NPC is walking to it is followed to the new place on
* the next read, the same way the bed itself is. */
PROJECTELERI_API FTransform ResolveAnchorTransform(const AActor* Anchor);
}