# Why the scaling and rotation animations behave differently when applying the physics engine?

**URL:** <https://forum.babylonjs.com/t/why-the-scaling-and-rotation-animations-behave-differently-when-applying-the-physics-engine/10659>\
**Category:** Questions\
**Created:** [May 8, 2020, 1:49pm UTC](https://forum.babylonjs.com/t/why-the-scaling-and-rotation-animations-behave-differently-when-applying-the-physics-engine/10659 "2020-05-08T13:49:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![LeJohn](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/lejohn/32/35093_2.png) [@LeJohn](https://forum.babylonjs.com/u/LeJohn)\
**Post date:** [May 8, 2020, 1:49pm UTC](https://forum.babylonjs.com/t/why-the-scaling-and-rotation-animations-behave-differently-when-applying-the-physics-engine/10659/1 "2020-05-08T13:49:35Z")

</div>

Hi,

I have a question about the relationship between animations and the physics engine.

I’m trying to do something like this:  
Step one: Animate a mesh with a simple rotation.  
Step two: stop the animation.  
Step three: apply an impostor on the mesh (to have a realistic rebound effect).  
Last step: remove the impostor and restart the animation.

[https://www.babylonjs-playground.com/#6TPYT7#4](https://www.babylonjs-playground.com/#6TPYT7#4)

As you can see in the playground, I have two different behaviors:  
If the animation is about scaling, everything is fine. But, for the rotation, I encounter a problem: the animation never restarts.

Can someone explain these two different behaviors to me, please? Is there a way to properly restart the rotation animation?

Thank you !

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [May 8, 2020, 2:10pm UTC](https://forum.babylonjs.com/t/why-the-scaling-and-rotation-animations-behave-differently-when-applying-the-physics-engine/10659/2 "2020-05-08T14:10:02Z")

</div>

Pinging @RaananW

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [May 8, 2020, 2:28pm UTC](https://forum.babylonjs.com/t/why-the-scaling-and-rotation-animations-behave-differently-when-applying-the-physics-engine/10659/3 "2020-05-08T14:28:18Z")

</div>

A simple reason 🙂 The physics engine is setting the rotationQuaternion of the object. Once the object has a quaternion, rotation.x will not animate, as it will take the rotation from the quaternion instead.

One option is to set it to be undefined:

[https://www.babylonjs-playground.com/#6TPYT7#5](https://www.babylonjs-playground.com/#6TPYT7#5)

The other is to use the rotate() function instead of animation for the rotation part. But I will leave it to you to decide which fits better 🙂

---

<div class="post-metadata">

**Author:** ![LeJohn](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/lejohn/32/35093_2.png) [@LeJohn](https://forum.babylonjs.com/u/LeJohn)\
**Post date:** [May 8, 2020, 3:00pm UTC](https://forum.babylonjs.com/t/why-the-scaling-and-rotation-animations-behave-differently-when-applying-the-physics-engine/10659/4 "2020-05-08T15:00:46Z")

</div>

Thanks for the explanation and for responding so quickly! 👏
