setAngularVelocity Locally not Globally

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:

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.

Pinging @trevordev

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

Any of them:
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
but with applied forces.

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

2 Likes