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