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

Deproject LGUI's screen position to world

If we want to use a UIItem to control a actor location on 3d world this is what we want.

The main point is to use two nodes: One is Convert Position from LGUICanvas to Viewport, which is provided by LGUICanvasScaler:

Property:Function:
TargetA reference to LGUICanvasScaler object.
PositionInput position in LGUI's screen space. Note left bottom is zero position, so for UIItem who provide this value, should set Anchors to Left Bottom, and the parent of UIItem should set to full screen size.
Return ValueResult screen space position, note left top is zero position.

Another is Deproject Screen to World, which is UnrealEngine's default node:

We can link these nodes like the screen shot below:

We can use the result World Position and World Direction to generate line trace. Control is a UIBaseActor represent for a screen UI element, Root is the ScreenSpaceUIRoot actor which hold the LGUICanvasScaler component.

Last Updated:
Contributors: lf2007hf
Prev
Project 3d world position to LGUI's screen 2d position
Next
Use custom material for UI elements