目录

UE5框选提示UI与目标对齐

UE5框选提示UI与目标对齐

关键功能

  1. Slot as Canvas Slot-> Set Position
  2. Get Cached Geometry
    • Local to Absolute
    • Absolute to Local

思路

  1. 获取目标UI组件的绝对坐标 Widget->Get Cached Geometry->Local to Absolute
  2. 把绝对坐标转换为CanvasPanel下的坐标CanvasPanel->Get Cached Geometry->Absolute to Local
    其中Local to Absolute的Local Coordinate 参数,00为左上角,DesireSize/2为中心点。根据要调整位置的UI组件的定位方式选择

https://i-blog.csdnimg.cn/direct/280d1036bf26403c8432dd33b1850219.png