跳转至

鼠标点击从屏幕空间到世界:Convert Mouse Location To World Space + Line Trace

把鼠标当前的屏幕位置转换成世界空间的射线起点和方向,再用 Line Trace By Channel 检测点中的物体。

蓝图连法

鼠标位置转世界空间并射线检测

  1. Get Player Controller(Player Index = 0)。
  2. Return Value 接 Convert Mouse Location To World Space(Target is Player Controller),输出 World Location 和 World Direction。
  3. World Direction × Make Literal Float(5000.0),再与 World Location 相加(+)得到射线终点。
  4. 接 Line Trace By Channel:
    • Start = World Location
    • End = World Location + World Direction × 5000
    • Trace Channel = 可视性(Visibility)
    • 输出 Out Hit 各项(Hit Actor、Hit Location 等)即可拿到点中的物体。

相关

ID:29 | 更新:2026-06-11