Vision Target
Something observers can notice: the player, an NPC, a body on the floor, an open door. A Vision Perception notices a target while its Vision Source sees it. A target's own colliders never hide it.

Settings
| Setting | Default | Description |
|---|---|---|
| Noticeability | 1 | How fast observers notice this target. 1 = normal, 0.5 = crouching or in camouflage, 0 = invisible, 2 = conspicuous. The label under the slider names the range |
| Visible Points | Empty | Optional points that can be seen. The target is seen if any of them is visible. Empty = the object's position |
Visible points
By default an observer checks a single point: the target's position. That is enough for small characters. For large targets, a point in the middle can be hidden behind a corner while half of the target sticks out. Add child objects around the target's outline and assign them to Visible Points:
- a vehicle or a large monster: its corners or the ends of its body;
- a character: left and right shoulder, so it is noticed as soon as one side comes out of cover.
When points are assigned, only these points are checked. To include the center as well, add a point there too.
In 3D, place the points horizontally around the target. Vision in 3D is computed on the ground plane at the eye height of each observer, so the height of a point is ignored. Points stacked above each other, such as head and feet, land on the same spot and add nothing.
Scripting
Namespace Renvix.VisionFog.
| Member | Description |
|---|---|
float Visibility | Noticeability. Change it at runtime for stealth mechanics |
bool IsSeenBy(VisionSource source, out Vector3 seenPoint) | True if the source sees the target; returns the first visible point |
Vector3 Position | The target's position |
void RefreshColliders() | Re-reads the target's own colliders. Call it after adding or removing colliders at runtime |
static IReadOnlyList<VisionTarget> All | All enabled targets |
Example: crouching and shadows
using Renvix.VisionFog;
using UnityEngine;
public class PlayerStealth : MonoBehaviour
{
[SerializeField] VisionTarget target;
public bool Crouching { get; set; }
public bool InShadow { get; set; }
void Update()
{
float visibility = 1f;
if (Crouching) visibility *= 0.5f;
if (InShadow) visibility *= 0.4f;
target.Visibility = visibility;
}
}