Table of Contents

Method TryGetClearGround

Namespace
GrindFest
Assembly
GrindFest.dll

TryGetClearGround(Vector3, out Vector3, out string, Transform)

Ground for something a test is about to place, chosen so that it does not end up inside the scenery. Tries the requested spot first, then a ring around it, and reports what was in the way.

public static bool TryGetClearGround(Vector3 target, out Vector3 ground, out string occupiedBy, Transform ignore = null)

Parameters

target Vector3
ground Vector3
occupiedBy string
ignore Transform

Returns

bool

Remarks

"On the terrain" is not the same as "in open air". A rock, crate, campfire or bot standing on the ground is NOT in the ground layer, so a layer-correct ground probe cheerfully returns the terrain UNDER it and the prop is placed inside the scenery - measured candidate at the hero's own spot: 'CopilotBot' (Default layer) at y=12.80 against terrain at 11.37.

Occupancy is measured the same way as the ground: a downward ray on ~GroundLayerMask (everything that is not ground - props, walls, trees, monsters), triggers ignored. Anything hit above ground + 10 cm is in the way. The Darkness plane that fooled the old ground probe cannot register as a blocker: it sits BELOW the terrain.

Returns true when ground was found - with occupiedBy set when every candidate was in the way, so the caller can place anyway and say so out loud instead of failing silently.