TerrainBrushPreview

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

A TerrainBrushPreview shows where a terrain brush is and how big it is: a thin ring at the brush's edge, and a fainter ring at half its size, where the default falloff is at half strength. Both rings follow the ground, a little above it, so they can be seen over hills and in hollows. Each ring is yellow with a black edge on both sides, so it shows on light ground and on dark ground. Call Place every frame the brush moves or the ground under it changes. The rings' mesh is made once and then updated in place, so moving the preview uses no new memory. It doesn't cast shadows.

Example Code

use Libraries.Game.Game
use Libraries.Game.Graphics.Worlds.TerrainBrushPreview
use Libraries.Game.Graphics.Worlds.TerrainData

class Main is Game
TerrainData data
TerrainBrushPreview preview

action Main
    UseVulkan(true)
    StartGame()
end

action CreateGame
    data:AddRegion(0, 0)
    preview:Place(data, 20, 20, 5)
    Add(preview)
end
end

Actions

Place(Libraries.Game.Graphics.Worlds.TerrainData data, number centerX, number centerZ, number radius)

This action moves the preview to a brush's center and size, shaping the rings to the ground. Parts of the rings over places with no region sit at the height of the ground under the center.

Parameters

  • data Libraries.Game.Graphics.Worlds.TerrainData: The terrain the brush is over.
  • centerX number: The brush's center along x, in world units.
  • centerZ number: The brush's center along z, in world units.
  • radius number: The brush's size, in world units.

SetRingColor(number red, number green, number blue)

This action sets the rings' color; their black edges stay black. The default is yellow. A scene editor uses green for a ramp's start, and red for the brush while it marks a ramp's end.

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.

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