Skip to content

FieldReceiverWrapper

public class FieldReceiverWrapper : TransformNodeWrapper

Component-logic handle on a FieldReceiver marker, exposed as Rendering.<Name>. It is a transform node (aim it, mount it on a servo horn, cast from it) that also SENSES: Sample reads a named field through the marker’s own shape, so a part only reads what it can actually see.

The difference from the transform node’s own SampleField is the shape. That one samples a point, optionally weighted by a facing, which is Lambert’s cosine over a whole hemisphere. This one applies the marker’s cone or box, which is what a datasheet’s half-angle means and what isolating one half of an optocoupler needs. Where a part just wants “the value here”, the plain sampler is still the smaller tool.

Agnostic by construction: nothing here says photodiode. The field name is the author’s free string, the same one the emitter publishes.

public double LastSample { get; }

The last value Sample returned, for reading back from a physics tick when the sensing itself runs in Update.

public bool Enabled { get; set; }

Off accepts no source at all, so a sample reads only the enclosing zone’s ambient base, or the fallback where no zone carries the field. What a power-down pin drives.

public double Range { get; set; }

How far the receiver looks, in mm (at least 0.001). Ignored while the marker extends to infinity, and by a Box, which carries its own extents.

public double ConeDegrees { get; set; }

Half-angle of the acceptance cone, in degrees, held between 0.5 and 89.5; used by the Cone shape only. An iris, a zoom, a shutter that narrows what the part will admit.

public double Sample(string name, double fallback);

The value of a named field at this marker, weighted by its shape: the enclosing zone’s ambient base plus every source of that name the shape accepts, or fallback when nothing answers.

Main thread (it reads scene transforms). Called from PhysicsUpdate it returns the last value sampled on the main thread, the same rule every other sensing read here follows - a physics tick is not allowed to walk the scene.

The ambient base is NOT weighted by the shape. A zone value is the field at a place and the marker is always inside its own volume, so narrowing a cone does not quietly drop the room light. A Box therefore isolates this receiver from SOURCES, not from the zone it sits in.

Generated from the CRUMB source, commit fcec660d, 2026-10-29.