相对坐标转世界坐标
//For example, if T was an object's transform, this would transform a position from local space to world space.
FVector UKismetMathLibrary::TransformLocation(const FTransform& T, FVector Location)
{
return T.TransformPosition(Location);
}
T 取父控件的WorldTransfrom, 假如PosB 为 ActorA 的RootComponent上一点坐标,则T取的为ActorA的Transfrom。Location取 PosB 在RootComponent的 RelativeLocation。
世界坐标转相对坐标
//For example, if T was an object's transform, this would transform a position from world space to local space.
FVector UKismetMathLibrary::InverseTransformLocation(const FTransform& T, FVector Location)
{
return T.InverseTransformPosition(Location);
}