GetClosestPointonCollision returns point on parent instead of welded child.
From user: "The problem appears to be in PhysicsInterfacePhysX.cpp in GetSquaredDistanceToBody, line 2873. When UPrimitiveComponent::GetClosestPointOnCollision gets a physics body to query (PrimiteComponentPhysics.cpp, line 833) it is sure to get the unwelded FBodyInstance of the component itself rather than anything it is welded to, which is then passed to FPhysicsInterface_PhysX::GetSquaredDistanceToBody. However, if this body is welded to anything, FPhysicsInterface_PhysX::GetSquaredDistanceToBody ignores it and queries the weld parent instead, undoing what was done in UPrimitiveComponent::GetClosestPointOnCollision to ensure the correct FBodyInstance is used: const FBodyInstance* UseBI = InInstance->WeldParent ? InInstance->WeldParent : InInstance; While the parent FBodyInstance will include any bodies of the child which has been welded to it, FPhysicsInterface_PhysX::GetSquaredDistanceToBody later excludes any bodies in UseBI which do not originate in UseBI (Line 2905: if(UseBI->IsShapeBoundToBody(ShapeRef) == false) //skip welded shapes that do not belong to us) causing it to ignore any physics bodies originating from the child physics body we were querying in the first place and, in effect, only querying the welded parent."
Confirmed in 4.23 Main @ CL 5446668
4.20 Example Project Attached
4.20 Result: Closest point on child mesh is returned (Expected)
4.21+ Result: Closest point on parent mesh is returned
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-71847 in the post.
13 |
Component | UE - Simulation - Physics |
---|---|
Affects Versions | 4.22, 4.23, 4.21.2 |
Created | Mar 21, 2019 |
---|---|
Resolved | Aug 27, 2021 |
Updated | Aug 27, 2021 |
6227 - Teiwaz83 |