Home
  • English
  • 中文
Home
  • English
  • 中文
  • Get Started

    • Install
    • Hello LGUI
    • Custom Button
    • Use custom font
    • Prefab workflow
    • Interaction
    • Button from scratch
  • Sample Projects

    • Sample Projects
  • Prefab Workflow

    • LGUI Prefab
    • PrefabEditor
    • LGUILifeCycleBehaviour
    • LGUIPrefabInterface
  • Rendering

    • LGUICanvas
    • Screen Space Overlay
    • World Space - UE Renderer
    • World Space - LGUI Renderer
    • LGUI render flow
    • UICanvasGroup
  • Visual Components

    • UIText
    • UIEffect
    • TextAnimation
    • UIBackgroundBlur
    • UIBackgroundPixelate
  • Events

    • LGUIEventDelegate
    • LGUIEventSystem
  • Interaction Components

    • UISelectable component
  • Layout

    • Basic Layout
    • Auto Layout
  • Tween Animation

    • LTween
    • Use LTween for UI element
  • Performance

    • LGUI Stat
  • ReleaseNotes

    • LGUI 3.x
    • LGUI 2.x
  • FAQ

    • Why use prefab?
    • Update project from LGUI2 to LGUI3
    • Project 3d world position to LGUI's screen 2d position
    • Deproject LGUI's screen position to world
    • Use custom material for UI elements
    • Disable interaction component
    • Find Child by DisplayName
    • Get actor or component inside prefab
    • Anti-aliasing

Project 3d world position to LGUI's screen 2d position

This is useful when we want to create a floating health bar on our character.

The main point is to use two nodes: One is Project World to Screen, which is UnrealEngine's default node:
Another is Convert Position from Viewport to LGUICanvas, which is provided by LGUICanvasScaler:

Property:Function:
TargetA reference to LGUICanvasScaler object.
PositionInput position, which is output from Project World to Screen node.
Return ValueResult LGUI's screen space position. Note left bottom is zero position, so for UIItem who need to use the result value, should set Anchors to Left Bottom, and the parent of UIItem should set to full screen size.

We can link these nodes like the screen shot below:

Healthbar is a UIBaseActor represent for a healthbar, Root is the ScreenSpaceUIRoot actor which hold the LGUICanvasScaler component.

Last Updated:
Contributors: lf2007hf
Prev
Update project from LGUI2 to LGUI3
Next
Deproject LGUI's screen position to world