DIFF

class CCTLiquidSyntheticCursor

CCTLiquidSyntheticCursor › CCTLiquid › CCTBase

Liquid target condition with camera based cursor reconstruction.

Some actions (fishing) must be usable while aiming at open water where the engine action cursor returns no hit at all, or returns a synced Y that is off the sea plane. This condition reconstructs a cursor from the camera ray and keeps it stable across frames.

Only actions that actually need this should use it, everything else uses the plain CCTLiquid, which does not run any of the code below.

Constructors 1

void CCTLiquidSyntheticCursor(int allowedLiquidSource, float maximalTargetDistance = UAMaxDistances.DEFAULT, float maxVerticalReach = UAMaxDistances.DEFAULT, SurfaceDetectionType surfaceDetectionType = SurfaceDetectionType.Roadway, bool allowSeaLevelCursorFallback = true)

Constants 11

protected const float SEA_FALLBACK_DISTANCE_BUFFER = 1.5
protected const float SYNTHETIC_POND_SAMPLE_STEP = 1.0
protected const float SYNTHETIC_POND_SURFACE_TOLERANCE = 0.35
protected const float SYNTHETIC_POND_FALLBACK_SURFACE_TOLERANCE = 1.75
protected const float SYNTHETIC_CURSOR_DISTANCE_BUFFER = 1.5
protected const float SEA_CURSOR_STICK_DISTANCE = 0.75
protected const int SEA_CURSOR_STICK_TIME_MS = 350
protected const float SYNTHETIC_CURSOR_CACHE_AIM_TOLERANCE = 1.75
protected const int SYNTHETIC_CURSOR_CACHE_MAX_AGE_MS = 350
protected const float SEA_CURSOR_MIN_DOWN_DOT = 0.035
protected const float POND_MAX_CAMERA_DIR_Y = 0.15

Members 9

protected int m_LastSyntheticHitCursorTime
protected float m_SafeSeaDistanceSq

Derived once, used by every camera ray path.

protected float m_StickDistanceSq
protected float m_CacheAimToleranceSq
protected ref array<Shape> m_DebugSyntheticCursorShapesDIAG_DEVELOPER

Methods 21

override bool CanContinue(PlayerBase player, ActionTarget target)
References CCTLiquid.Can()
override protected bool ResolveSyntheticCursor(PlayerBase player, vector playerPos, ActionTarget target, Object targetObj, vector hitPosition)

Re-validate during action

protected bool TryResolveSyntheticCursor(PlayerBase player, vector playerPos, vector currentHitPosition, out vector resolvedHitPosition, out int resolvedLiquidType)

Only relevant when there is no target object at all.

protected bool TryBuildSyntheticCursor(PlayerBase player, vector playerPos, out vector syntheticHitPosition, out int syntheticLiquidType)

Validate the generated cursor once.

protected bool TryGetCameraRay(out vector cameraPos, out vector cameraDir)

Let final validation detect exact liquid type.

protected bool TryValidateHitCursor(PlayerBase player, vector playerPos, vector hitPosition, out vector resolvedHitPosition, out int resolvedLiquidType)

Last chance: use closest sampled surface if it was very close.

protected bool TryValidatePondHitPosition(vector playerPos, vector hitPosition, out vector surfacePos, out int liquidType, int expectedLiquidType = LIQUID_NONE)

Freshwater / pond path.

protected bool IsValidPondHitPosition(vector playerPos, vector hitPosition, int liquidType = LIQUID_NONE)

If caller expected a specific liquid mask/type, require compatibility.

protected bool IsSeaHitPositionValid(vector playerPos, vector hitPosition)
protected void ClearSyntheticCursorCache()

Engine query last.

protected bool TryUseCachedSyntheticCursor(PlayerBase player, vector playerPos, vector currentHitPosition, out vector resolvedHitPosition, out int resolvedLiquidType)
protected bool IsCachedSyntheticCursorRelevant(vector currentHitPosition, vector cachedHitPosition)

Important: cached cursor must still match current aim.

protected bool IsPositionNearCurrentCameraRay(vector position, float maxPerpendicularDistance)

If there is no real hit, compare cached point to current camera ray.

protected vector GetRaycastTarget(vector surfacePos)

Liquid points are raycast against slightly above the surface.

protected bool IsNearlyEqual(vector a, vector b)
protected void ClearDebugCursorShapes()DIAG_DEVELOPER