From 681dcd60297a5cb25e6821ce2dbac63cd32dcd7a Mon Sep 17 00:00:00 2001
From: dearamy <dearamy0215@gmail.com>
Date: Wed, 28 Sep 2022 12:32:55 +0800
Subject: [PATCH] [Landscape] Fix bug landscape offset not taking care of
 rotation

---
 .../Private/HoudiniEngineRuntimeUtils.cpp                   | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Source/HoudiniEngineRuntime/Private/HoudiniEngineRuntimeUtils.cpp b/Source/HoudiniEngineRuntime/Private/HoudiniEngineRuntimeUtils.cpp
index 3d43cf5318..6d9d5fecc3 100755
--- a/Source/HoudiniEngineRuntime/Private/HoudiniEngineRuntimeUtils.cpp
+++ b/Source/HoudiniEngineRuntime/Private/HoudiniEngineRuntimeUtils.cpp
@@ -520,9 +520,11 @@ FHoudiniEngineRuntimeUtils::CalculateHoudiniLandscapeTransform(ULandscapeInfo* L
 	FVector3d ExtentMax = FVector3d(Extent.Max.X * LandscapeScale.X, Extent.Max.Y * LandscapeScale.Y, 1.0);
 	
 	// Add section base offset to the landscape transform
+	FTransform Trans = FTransform::Identity;
+	Trans.CopyRotation(OutTransform);
+	const FVector Offset = Trans.TransformPosition( FVector(ExtentCenter.X * LandscapeScale.X , ExtentCenter.Y * LandscapeScale.Y, 0));
 	FVector3d Loc = OutTransform.GetLocation();
-	Loc.X += ExtentCenter.X * LandscapeScale.X;
-	Loc.Y += ExtentCenter.Y * LandscapeScale.Y;
+	Loc += Offset;
 	
 	OutTransform.SetLocation(Loc);