Update of collision mesh for animated skeletal mesh is delayed

What I try to do

  1. Update the pose of a skeletal mesh using the AnimBP
  2. From the actor retrieve the updated bone position
  3. Line trace towards that bone position and retrieve the mesh intersection

To make sure the order of execution is correct I used AddTickPrerequisite to tick the actor after the skeletal mesh and just to be sure also set the tick group of the actor to Post Update Work. From the tick logs ( tick.LogTicks) the execution order looks correct.


It seems that the collision mesh is delayed by one frame. It becomes most apparent when using a low frame rate or small or fast objects. In these cases the line trace does not register a hit anymore, but visually it hits the (rendered != collision) mesh.

When looking at the engine code in USkeletalMeshComponent::PostAnimEvaluation() there is a call to USkeletalMeshComponent::UpdateKinematicBonesToAnim(), which in case of bEnablePerPolyCollision computes the skinned vertex positions and updates the collision mesh using FBodyInstance::UpdateTriMeshVertices(). But the changes only seem to be active in the next frame.

Using collision primitives (e.g. Capsules and not TriMesh) updates properly in the current frame, which is also executed in USkeletalMeshComponent::UpdateKinematicBonesToAnim() (but for my application I need to know the mesh vertex so this approach is not feasible).


When is the updated collision mesh activated in the physics engine? How can I force this update to happen?