Updated observation logic

This commit is contained in:
koritsa
2026-05-30 15:35:59 +03:00
parent 26fb88bc90
commit e70b1d757c
9 changed files with 190 additions and 47 deletions
@@ -6,6 +6,7 @@
#include "GameFramework/Character.h"
#include "InputAction.h"
#include "InputMappingContext.h"
#include "NakedDesire/Clothing/BodyPart.h"
#include "NakedDesire/Global/Gait.h"
#include "NakedDesire/Global/NakedDesireUserSettings.h"
#include "NakedDesire/Global/Stance.h"
@@ -121,7 +122,18 @@ public:
virtual void NotifyControllerChanged() override;
virtual void BeginPlay() override;
virtual UAISense_Sight::EVisibilityResult CanBeSeenFrom(const FCanBeSeenFromContext& Context, FVector& OutSeenLocation, int32& OutNumberOfLoSChecksPerformed, int32& OutNumberOfAsyncLosCheckRequested, float& OutSightStrength, int32* UserData = nullptr, const FOnPendingVisibilityQueryProcessedDelegate* Delegate = nullptr) override;
// Player exposure as read by an observer at ObserverLocation, in [0, 3]: the sum over the
// LOS-visible body regions (top -> Boobs, bottom -> Ass + Genitals) of (1 - effective coverage)
// for parts below ObservationRevealThreshold. 0 means nothing revealing is visible to them.
// Queried per observing NPC each tick by UStatsManager to drive embarrassment (GDD §7.1).
float GetObservedExposureFrom(const FVector& ObserverLocation, const AActor* IgnoreActor);
// Below this effective coverage [0,1] a body part reads as "revealing": observers notice it and
// it contributes to embarrassment. At or above it the part is treated as decently covered.
UPROPERTY(EditDefaultsOnly, Category = "Observation")
float ObservationRevealThreshold = 0.9f;
private:
EGait Gait = EGait::Walk;
EStance Stance = EStance::Stand;
@@ -135,6 +147,14 @@ private:
void OnInteractPress(const FInputActionValue& Value);
bool CheckSight(const FVector& StartLocation, const FVector& EndLocation, FHitResult& HitResult, const AActor* IgnoreActor);
// Traces observer->boobs_root and observer->pelvis for line of sight (top / bottom regions),
// then sums (1 - coverage) over the revealing parts in each LOS-visible region. The out-bools
// report raw line of sight per region (before coverage), used to pick a seen location.
float ComputeObservedExposure(const FVector& ObserverLocation, const AActor* IgnoreActor, bool& bOutTopVisible, bool& bOutBottomVisible);
// (1 - effective coverage) when BodyPart is below ObservationRevealThreshold, else 0.
float RevealAmount(EBodyPart BodyPart);
UFUNCTION(Exec)
void LogTest();