# setAngularVelocity Locally not Globally

**URL:** <https://forum.babylonjs.com/t/setangularvelocity-locally-not-globally/3567>\
**Category:** Questions\
**Created:** [May 28, 2019, 8:19pm UTC](https://forum.babylonjs.com/t/setangularvelocity-locally-not-globally/3567 "2019-05-28T20:19:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [May 28, 2019, 8:19pm UTC](https://forum.babylonjs.com/t/setangularvelocity-locally-not-globally/3567/1 "2019-05-28T20:19:21Z")

</div>

I have been struggling trying to set the angular velocity of a physicsImposter with its local velocities not its “global”

IE if I pitch a model 90deg then try to roll it it will do a “yaw” instead in relation to the global axes  
I have tried:

```auto
var playerBody = this.player.physicsImpostor
var currentYPR = playerBody.getAngularVelocity()
var m = new BABYLON.Matrix();
this.player.rotationQuaternion.toRotationMatrix(m);		
currentYPR = BABYLON.Vector3.TransformCoordinates(currentYPR, m);

```

but this does not give me the desired effect.

---

<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 28, 2019, 8:25pm UTC](https://forum.babylonjs.com/t/setangularvelocity-locally-not-globally/3567/2 "2019-05-28T20:25:34Z")

</div>

Pinging @trevordev

---

<div class="post-metadata">

**Author:** ![trevordev](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/trevordev/32/16_2.png) [@trevordev](https://forum.babylonjs.com/u/trevordev)\
**Post date:** [May 29, 2019, 12:21am UTC](https://forum.babylonjs.com/t/setangularvelocity-locally-not-globally/3567/3 "2019-05-29T00:21:38Z")

</div>

Hey, do you have a playground that repro’s this? What physics plugin are you using?

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [May 29, 2019, 1:49am UTC](https://forum.babylonjs.com/t/setangularvelocity-locally-not-globally/3567/4 "2019-05-29T01:49:37Z")

</div>

Any of them:  
[https://playground.babylonjs.com/#2TP55R](https://playground.babylonjs.com/#2TP55R)  
so basically I need to figure out how to rotate my new force by the targets current forward and make it behave like this:  
[https://playground.babylonjs.com/#2TP55R#1](https://playground.babylonjs.com/#2TP55R#1)  
but with applied forces.

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [May 29, 2019, 4:08am UTC](https://forum.babylonjs.com/t/setangularvelocity-locally-not-globally/3567/5 "2019-05-29T04:08:18Z")

</div>

holy crap I figured it out…  
[https://playground.babylonjs.com/#2TP55R#2](https://playground.babylonjs.com/#2TP55R#2)
