# SetActorRotation restarts simulation

**URL:** <https://forums.unrealengine.com/t/setactorrotation-restarts-simulation/298108>\
**Category:** World Creation\
**Tags:** simulate-physics, unreal-engine, question\
**Created:** [November 4, 2014, 11:28am UTC](https://forums.unrealengine.com/t/setactorrotation-restarts-simulation/298108 "2014-11-04T11:28:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Spider\_2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Spider\_2](https://forums.unrealengine.com/u/Spider_2)\
**Post date:** [November 4, 2014, 11:28am UTC](https://forums.unrealengine.com/t/setactorrotation-restarts-simulation/298108/1 "2014-11-04T11:28:02Z")

</div>

Hello,

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’.

Is there any magic flag to fix this ?

---

<div class="post-metadata">

**Author:** ![Spider\_2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Spider\_2](https://forums.unrealengine.com/u/Spider_2)\
**Post date:** [November 5, 2014, 1:35pm UTC](https://forums.unrealengine.com/t/setactorrotation-restarts-simulation/298108/2 "2014-11-05T13:35:50Z")

</div>

After some investigation I’ve found something:

```
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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [November 5, 2014, 4:34pm UTC](https://forums.unrealengine.com/t/setactorrotation-restarts-simulation/298108/3 "2014-11-05T16:34:02Z")

</div>

Hey Spider-

Here is the documentation on UpdateKinematicBonesToPhysics: [https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/Components/USkeletalMeshComponent/UpdateKinematicB-/index.html](https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/Components/USkeletalMeshComponent/UpdateKinematicB-/index.html)

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.

Cheers

---

<div class="post-metadata">

**Author:** ![Spider\_2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Spider\_2](https://forums.unrealengine.com/u/Spider_2)\
**Post date:** [November 6, 2014, 6:41pm UTC](https://forums.unrealengine.com/t/setactorrotation-restarts-simulation/298108/4 "2014-11-06T18:41:35Z")

</div>

Yes, but still cant find what is forcing other behavior for Pawns than Character. I have simple repro for this problem:

1. Create blueprint from Pawn
2. Add skeletal mesh component to Pawn\_BP
3. Set the mesha/physics asset/simple animation blueprint
4. Set collision to block all
5. From event tick call the “Add Actor Local Offset” with some offset

See the shaking physics bodies that jumps into bone animation location.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [November 12, 2014, 8:25pm UTC](https://forums.unrealengine.com/t/setactorrotation-restarts-simulation/298108/5 "2014-11-12T20:25:04Z")

</div>

Hey Spider-

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.

---

<div class="post-metadata">

**Author:** ![Spider\_2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Spider\_2](https://forums.unrealengine.com/u/Spider_2)\
**Post date:** [November 13, 2014, 8:45am UTC](https://forums.unrealengine.com/t/setactorrotation-restarts-simulation/298108/6 "2014-11-13T08:45:55Z")

</div>

Hey ,

I found what is the problem. I had to add this line into my implementation of Pawn:

```
Mesh->PrimaryComponentTick.AddPrerequisite(MovementComponent, MovementComponent->PrimaryComponentTick);

```

Fixed. Thanks for helping! 🙂
