Description

The result with Chaos is not wrong, rather it returns a correct correction vector, that vector is perfectly horizontal to the teleport buried against the landscape mesh.
Therefore, teleportation will fail.

The following workarounds provide developer-friendly results. This code is almost identical to the hack in GJKContactPointImp.

	template <typename QueryGeomType>
	bool FHeightField::OverlapGeomImp(const QueryGeomType& QueryGeom, const FRigidTransform3& QueryTM, const FReal Thickness, FMTDInfo* OutMTD) const
	...
			TTriangle<FReal> TriangleConvex(A, B, C);
			if (InnerMTD)
			{
				if (bOneSidedHeightField)	// workaround begins
				{
					// This code is similar to the hack in GJKContactPointImp
					FReal Penetration = 0;
					TVec3<FReal> ClosestA(0);
					TVec3<FReal> ClosestB(0);
					TVec3<FReal> Normal(0);
					const TAABB<FReal, 3> Bounds = QueryGeom.BoundingBox();
					const float ApproximateSizeOfObject = Bounds.Extents()[Bounds.LargestAxis()];
					const float ApproximateDistToObject = FVec3::DistSquared(QueryTM.GetLocation(), A);
					const float SweepLength = ApproximateSizeOfObject + ApproximateDistToObject;
					const FVec3 TriNormal = Offset.GetUnsafeNormal();
					const FRigidTransform3 QueryStartTM(QueryTM.GetLocation() + TriNormal * SweepLength, QueryTM.GetRotation());
					if (GJKRaycast2(TriangleConvex, QueryGeom, QueryStartTM, -TriNormal, SweepLength, Penetration, ClosestB, Normal, 0.f, true))
					{
						// Use Deepest MTD.
						if (Penetration > InnerMTD->Penetration)
						{
							InnerMTD->Penetration = Penetration;
							InnerMTD->Normal = Normal;
						}
						return true;
					}
				}
				else	// workaround ends
				{
					TVec3<FReal> TriangleNormal(0);
					FReal Penetration = 0;
					TVec3<FReal> ClosestA(0);
					TVec3<FReal> ClosestB(0);
					int32 ClosestVertexIndexA, ClosestVertexIndexB;
					if (GJKPenetration(TriangleConvex, QueryGeom, QueryTM, Penetration, ClosestA, ClosestB, TriangleNormal, ClosestVertexIndexA, ClosestVertexIndexB, Thickness, 0.0f, TVector<FReal, 3>(0, 0, -1)))
					{
						// Use Deepest MTD.
						if (Penetration > InnerMTD->Penetration)
						{
							InnerMTD->Penetration = Penetration;
							InnerMTD->Normal = TriangleNormal;
						}
						return true;
					}
				}
				return false;
			}

 

Steps to Reproduce
  1. open attached project on 4.26 and 4.26-chaos
  2. Open TeleportToLandScapeTest level
  3. Start PIE

 

[Image Removed][Image Removed]

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-119029 in the post.

0
Login to Vote

Won't Fix
ComponentUE - Simulation - Physics
Affects Versions4.26-chaos5.1
CreatedJun 25, 2021
ResolvedMay 19, 2023
UpdatedAug 16, 2023
View Jira Issue