ScenePlacementDescription

Package: Libraries.Interface.Controls.Scenes · Inherits from: Libraries.Language.Object

ScenePlacementDescription says where a 3D item rests, for a screen reader, after it moves: what it is on (the highest surface within half a meter under it, or the ground), how far above that it is, where on it it sits, and what is wrong (sunk into something, floating), in the same compass words as the camera (north is +z, east is +x): "Candle, now on Table, 0.1 meters above it, near the west edge." It only searches near the item, with the layer's render tree, so its cost doesn't grow with the scene. The moved item's box is measured from its shape, as SceneEditor:GetGroundChange measures it, so it is current in the middle of a move; other items' boxes are the render tree's.

Example Code

use Libraries.Interface.Controls.Scenes.ScenePlacementDescription

ScenePlacementDescription placement
// With a scene editor, its 3D layer and a moved item:
// text words = placement:Describe(editor, layer, item, undefined)

Actions

Describe(Libraries.Interface.Controls.Scenes.SceneEditor editor, Libraries.Interface.Controls.Scenes.Layers.EditorLayer3D layer, Libraries.Interface.Controls.Scenes.Items.EditorModel item, Libraries.Interface.Item3D before)

Describes where the item rests, saying "now on" or "now off" when what it is on isn't what it was on before.

Parameters

Returns

text: The sentence

DescribeMove(Libraries.Compute.Vector3 from, Libraries.Compute.Vector3 toward)

Returns the way an item moved, from where it was to where it is, as a screen reader says it first: the compass word ("North-east"), then "up" or "down" for a change in height, such as "North-east, up", or "" if it didn't move. Moves under 0.01 meters are ignored.

Parameters

Returns

text: The way it moved, or ""

FindSupport(Libraries.Interface.Controls.Scenes.SceneEditor editor, Libraries.Interface.Controls.Scenes.Layers.EditorLayer3D layer, Libraries.Interface.Controls.Scenes.Items.EditorModel item, Libraries.Game.BoundingBox box)

Finds what the item is on: the highest item top no more than CONTACT_GAP above the item's bottom, whose footprint overlaps the item's, or the ground under its center (the highest terrain there, or height 0), whichever is higher. Then GetSupport says which, and it counts as on it if that top is within ON_GAP below the item.

Parameters

GetSupport()

Returns what the last Describe or FindSupport found the item on: an item, or undefined for the ground. The scene editor keeps it when a move starts, for "now on" and "now off".

Returns

Libraries.Interface.Item3D: The item it is on, or undefined for the ground

GetWorldBox(Libraries.Interface.Controls.Scenes.Items.EditorModel item)

Returns the item's box in the world: its shape's box after its transform, as SceneEditor:GetGroundChange measures it, or a point at its position if it has no shape.

Parameters

Returns

Libraries.Game.BoundingBox: A new box

Inherited Actions

3 actions from Libraries.Language.Object