Skip to main content

Billboard

Billboard spawns a 2D sprite in 3D space that always faces the camera. This is commonly used for markers, indicators, floating icons, or simple world labels. The billboard can be screen-size scaled or world-size scaled and can be textured using any valid sprite or texture asset

/// tip Billboard is an Actor so it inherits all functions from Actor ///

Constructorโ€‹

Example
local my_billboard = Billboard(
Vector(0, 0, 200),
'/Engine/EngineResources/DefaultTexture',
Vector2D(64, 64),
true
)
NameTypeDefaultDescription
LocationVector(0,0,0)World position where the billboard is placed
TexturePathstringRequiredAsset path to the texture or sprite
SizeVector2D(64,64)Desired screen size of the sprite (ignored if not in screen space mode)
bScreenSpacebooleanfalseIf true, sprite maintains size in screen space (UI-style)

Functionsโ€‹

SetUVโ€‹

Change which part of the texture (image) the sprite displays.

  • X: number โ€” how far to move right from the left edge of the texture (start position on the X axis)
  • Y: number โ€” how far to move down from the top edge of the texture (start position on the Y axis)
  • Width: number โ€” how wide the visible part of the texture should be
  • Height: number โ€” how tall the visible part of the texture should be

In simple terms, this function lets you crop the sprite to show only a specific rectangular area of the texture.

Example
my_billboard:SetUV(100, 100, 100, 100) -- shows a 100x100 section starting 100px right and 100px down

SetSpriteAndUVโ€‹

Change the spriteโ€™s texture and which part of that texture (UVs) is displayed.

  • TexturePath: Texture2D โ€” the texture (image) you want to display on the sprite
  • X: number โ€” how far to move right from the left edge of the texture (start position on the X axis)
  • Y: number โ€” how far to move down from the top edge of the texture (start position on the Y axis)
  • Width: number โ€” how wide the visible part of the texture should be
  • Height: number โ€” how tall the visible part of the texture should be

In simple terms, this sets a new image for the sprite and tells it which rectangular section of that image to show.

Example
local texture = UE.UObject.Load(TexturePath)
my_billboard:SetSpriteAndUV(texture, 100, 100, 100, 100) -- loads a new texture and shows a 100x100 area starting 100px right and 100px down

SetSpriteโ€‹

Change the texture (image) used by this sprite component.

  • TexturePath: Texture2D โ€” the texture you want the sprite to display

In simple terms, this replaces the spriteโ€™s current image with a new one.

Example
local texture = UE.UObject.Load(TexturePath)
my_billboard:SetSprite(texture) -- changes the spriteโ€™s image to the loaded texture

SetOpacityMaskRefValโ€‹

Change how transparent or solid parts of the sprite are, based on an opacity mask value.

  • Typical values: 0.3 to 0.5

  • Range: 0.0 (fully transparent) to 1.0 (fully opaque)

  • RefVal: number โ€” the reference value that controls how much of the texture is visible

In simple terms, this controls the cutoff point for transparency. Lower values make more of the texture see-through, while higher values make it appear more solid.

Example
my_billboard:SetOpacityMaskRefVal(0.5)
โœจ