FluidProbe2D
class in OpalScript
Observe water at a point on this object. Use wet/flow outputs and Entered, Exited or Splash events for swimming, pickups and water mechanics.
Properties
| Member | Description |
|---|---|
| FluidProbe2D.Wet | Point occupancy after the probe’s enter/exit hysteresis thresholds. |
| FluidProbe2D.Coverage | Smoothed point occupancy from 0 to 1, not submerged volume or depth. |
| FluidProbe2D.Velocity | Locally weighted water flow in world pixels per second; positive Y points down. |
| FluidProbe2D.Speed | Magnitude of local water velocity in pixels per second. |
| FluidProbe2D.RelativeSpeed | Speed of probe movement relative to local water in pixels per second. |
| FluidProbe2D.DomainAvailable | Whether the exact referenced domain is present and enabled in the current physics session. |
Events
| Member | Description |
|---|---|
| FluidProbe2D.entered | The sample point crossed the enter threshold. |
| FluidProbe2D.exited | The sample point fell below the exit threshold or its liquid domain became unavailable. |
| FluidProbe2D.splash | The point entered water above the relative entry speed threshold after a previous observation. |
Example
csharp
class WaterContact : Component {
void Start() {
FluidProbe2D probe = GetComponent<FluidProbe2D>();
if (probe != null) probe.splash.Subscribe(OnSplash);
}
void OnSplash(FluidContact contact) {
Debug.Log(contact.RelativeSpeed);
}
}