public sealed class SceneMeasureA tape measure: click two points and read the distance, three and read the angle.
Remarks
Doc 24 puts this in the group that "separates a toolset a professional will use from one they will try". Everything a level designer asserts is a measurement — the player fits through the gap, the jump is makeable, the sightline reaches — and an editor with no way to ask "how far is that" makes every one of them a guess or a temporary cube.
⚠ It snaps like everything else, and that is the whole of why it is worth having. A measurement between two points the pointer happened to land on is a number nobody can act on; between two corners it is the width of the doorway. The points come in already snapped — whoever is driving the gesture asks the same SnapContext a drag does — so this holds points rather than resolving them.
⚠ Three points, and the third is not a longer tape. Two points is a distance and three is an angle at the middle one, which is the second question anybody asks of a corner. A fourth starts a new measurement rather than extending the old one: a polyline's total length is a different tool and nobody reaches for it between playtests.
Fields and properties (6)
public const int CapacityHow many points one measurement holds.
public IReadOnlyList<Vector3> PointsThe points taken so far, in the order they were taken.
public bool IsActiveWhether the tool is taking points.
public bool HasMeasurementWhether there is anything to read.
public float DistanceHow long the tape is, in world units.
public float? AngleThe angle at the middle point, in degrees, or with fewer than three.
Methods (3)
public void Add(Vector3 point)Takes a point.
public void Clear()Throws the measurement away.
public string? Describe()What a readout should say, or when there is nothing to say.
Used by (6)
- EditorApplicationVixen.Editor.App
- PrecisionTestsVixen.Editor.SceneView.Tests
- SceneLinesVixen.Editor.SceneView
- SceneViewportVixen.Editor.SceneView
- ViewportChromeVixen.Editor.App
- WorkPlaneCommandTestsVixen.Editor.App.Tests