Skip to content

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 ​

MemberDescription
FluidProbe2D.WetPoint occupancy after the probe’s enter/exit hysteresis thresholds.
FluidProbe2D.CoverageSmoothed point occupancy from 0 to 1, not submerged volume or depth.
FluidProbe2D.VelocityLocally weighted water flow in world pixels per second; positive Y points down.
FluidProbe2D.SpeedMagnitude of local water velocity in pixels per second.
FluidProbe2D.RelativeSpeedSpeed of probe movement relative to local water in pixels per second.
FluidProbe2D.DomainAvailableWhether the exact referenced domain is present and enabled in the current physics session.

Events ​

MemberDescription
FluidProbe2D.enteredThe sample point crossed the enter threshold.
FluidProbe2D.exitedThe sample point fell below the exit threshold or its liquid domain became unavailable.
FluidProbe2D.splashThe 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);
    }
}

See also ​