I’ve created my own character class based on pawn, added movement component, mesh component, capsule collision ect. everything works fine but I’ve noticed some strange behaviour after setting the simulated physical asset to this actor.
Always when actor changes location or rotation then all bones simulated by physics resets their transformation to ‘animation state’.
void USkeletalMeshComponent::OnUpdateTransform(bool bSkipPhysicsMove)
{
// We are handling the physics move below, so don't handle it at higher levels
Super::OnUpdateTransform(true);
// Always send new transform to physics
if(bPhysicsStateCreated && !bSkipPhysicsMove )
{
UpdateKinematicBonesToPhysics(false, false, true);
}
#if WITH_APEX_CLOTHING
if(ClothingActors.Num() > 0)
{
// Updates cloth animation states because transform is updated
UpdateClothTransform();
}
#endif //#if WITH_APEX_CLOTHING
}
The “UpdateKinematicBonesToPhysics” is ‘responsible’ for this bug.
Could you tell me why and when execution of UpdateKinematicBonesToPhysics depends on actor movement?
I’ve tested the same physics asset on default “Character” and there is no problem with SetActorRotation so it looks like my implementation of player pawn have some small difference that forces to call on every transformation change UpdateKinematicBonesToPhysics.
It seems that when the function is called, the line BodyInstance.SetBodyTransform(CurrentLocalToWorld, bTeleport); may not be getting set properly and is resetting the bones rather than updating based on the movement.
I’m not sure I’m seeing the same thing that you’re describing through your repro steps. Could you post a screenshot of how your blueprint and animation blueprint are setup? A short video of the behavior you are experiencing will also be help give us an idea of what exactly is happening.