TerrainCursorCrosshair

Package: Libraries.Interface.Controls.Scenes.Items · Inherits from: Libraries.Interface.Item3D, Libraries.Interface.Item, Libraries.Language.Object, Libraries.Game.Graphics.Model

The TerrainCursorCrosshair is two lines through a scene editor's terrain cursor, one along x and one along z, laid over the ground out to the terrain's edges, with a small square tab at each end. Each line has a dark edge, so it shows on light and dark ground, and fades out softly at its sides, so it is smooth at any zoom. Like the beam, its width is set in screen terms from the camera's distance. It is an editor helper, not a scene item, and lets clicks through. Its meshes have a fixed number of pieces, so they are built once and then updated in place.

Example Code

use Libraries.Interface.Controls.Scenes.Items.TerrainCursorCrosshair
use Libraries.Game.Graphics.Worlds.TerrainData

TerrainData data
TerrainCursorCrosshair crosshair
crosshair:Place(data, 10, 20, 0, 100, 0, 100, 50)
crosshair:Recolor(1, 0.17, 0.84, 0.5)

Actions

Place(Libraries.Game.Graphics.Worlds.TerrainData data, number x, number z, number lowX, number highX, number lowZ, number highZ, number distance)

This action lays the lines over the ground through a point, out to the terrain's edges, sized for the camera's distance. It is built again only when the point moved or the size changed by more than a twentieth.

Parameters

  • data Libraries.Game.Graphics.Worlds.TerrainData: The terrain's data
  • x number: The cursor's place along x
  • z number: The cursor's place along z
  • lowX number: The terrain's smallest x
  • highX number: The terrain's largest x
  • lowZ number: The terrain's smallest z
  • highZ number: The terrain's largest z
  • distance number: The camera's distance from the cursor

Recolor(number red, number green, number blue, number opacity)

This action sets the lines' color and opacity. The color is drawn into the textures, made again only when it changes; the opacity is the model's color's alpha, so pulsing costs nothing more.

Parameters

  • red number: The red, from 0 to 1
  • green number: The green, from 0 to 1
  • blue number: The blue, from 0 to 1
  • opacity number: The opacity, from 0 to 1

Refresh(Libraries.Game.Graphics.Worlds.TerrainData data, number lowX, number highX, number lowZ, number highZ)

This action builds the lines again where they are, after the ground under them changed, such as after sculpting.

Parameters

  • data Libraries.Game.Graphics.Worlds.TerrainData: The terrain's data
  • lowX number: The terrain's smallest x
  • highX number: The terrain's largest x
  • lowZ number: The terrain's smallest z
  • highZ number: The terrain's largest z

Inherited Actions

112 actions from Libraries.Game.Graphics.Model
62 actions from Libraries.Interface.Item
211 actions from Libraries.Interface.Item3D
3 actions from Libraries.Language.Object