EntityHighlight entity[,enabled][,camera][,children]

Parameters

entity - model handle, or a hierarchy root when children is 1

enabled (optional) - 1 enables the visual highlight (default); 0 disables it

camera (optional) - 0 sets the default for all present/future cameras in the entity's world (default); a camera handle changes only that view

children (optional) - 1 also applies to models in the current subtree; 0 affects this entity only (default)

Description

Draws an outline around the visible parts of an entity without replacing its material.

Use it to mark a pickup, target, interactable machine or editor selection. A single EntityHighlight actor uses the default amber style automatically. Picking, targeting and game selection remain your program's logic.

Camera 0 sets the entity's default and clears its camera-specific overrides, even when repeating the current setting. EntityHighlight actor,0 therefore removes it from every view. A specific camera must belong to the same world. Hidden entities remain hidden. Copies start unhighlighted, and deleting entities or cameras removes their references. Highlight settings are transient and are not saved in worlds.

To change the style, load builtin:highlight and attach it using CameraEffect. Each camera has one style shared by its highlighted entities. Attaching a different highlight style replaces the previous style. Disabling the attached style suppresses highlighting in that camera; removing it restores the default. The style alone does not highlight any entities.

Color is a display colour (default 255,190,48). Width is 1-6 display pixels (default 2), independent of RenderScale. Strength is 0-1 (default 1); zero bypasses the effect. FillOpacity is 0-1 (default 0) and adds a tint inside visible coverage. Use ShaderColor for Color and ShaderFloat for the other parameters.

Classic, Standard and coverage-capable opaque/cutout built-ins preserve their material alpha holes, deformation and culling. Fully blended/refractive surfaces and line lists are unsupported; material diagnostics identify missing coverage support. Foreground surfaces hide the highlight; this is not a through-wall effect. Adjacent highlighted surfaces form one visible region rather than internal object borders.

EntityFX, EntityColor and EntityBlend keep their existing roles. There is no highlight FX bit: changing the entity's flags does not remove its highlight membership. Blending that makes a surface translucent may make it ineligible until it becomes opaque/cutout again. Highlighting is composed after scene filters and antialiasing, before the 2D canvas. It does not feed bloom or temporal colour history.

For the full story, see the illustrated highlight study.


See also: CameraEffect, CameraEffectEnabled, RemoveCameraEffect, EntityFX, CameraPick.

Example

; EntityHighlight Example
; -----------------------

Graphics3D 640,480,0,2
SetBuffer BackBuffer()

camera=CreateCamera()
PositionEntity camera,0,1,-5

light=CreateLight()
RotateEntity light,35,-25,0

; An interactable machine the player might target
prop=CreateCylinder(8)
ScaleEntity prop,0.7,1.2,0.7
PositionEntity prop,0,1,0
EntityColor prop,50,100,150

; A bystander entity that never gets the outline
crate=CreateCube()
ScaleEntity crate,0.6,0.6,0.6
PositionEntity crate,2,0.6,1
EntityColor crate,120,90,60

; The default amber style needs no separate setup
enabled=True
EntityHighlight prop

While Not KeyDown(1)

    ; Space toggles the outline on the machine
    If KeyHit(57)
        enabled=Not enabled
        EntityHighlight prop,enabled
    EndIf

    TurnEntity prop,0,1,0

    ; Arrow keys move the camera
    If KeyDown(200) Then MoveEntity camera,0,0,0.1
    If KeyDown(208) Then MoveEntity camera,0,0,-0.1
    If KeyDown(203) Then TurnEntity camera,0,1,0
    If KeyDown(205) Then TurnEntity camera,0,-1,0

    RenderWorld

    Text 0,0,"Arrow keys: move camera   Space: toggle highlight   Esc: exit"
    Text 0,20,"EntityHighlight prop,"+enabled+"   (foreground objects still hide it)"

    Flip

Wend

End

Index