UE4 相对座标转世界座标

UE4 Relative Location To World Location

相对座标转世界座标

//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);
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章