I have an airplane model and I just want it to fly in the direction that is pointing. Right now I am using getEulerAngles() and doing some cos and sin calculations on the x y z in order to get some kind of forward vector.
It isn’t working though. Is there anything built in for this?
we have gone over some of that stuff… If I had it 100% figured out id break it down for you but Its been a work in progress to get yaw pitch and roll correct.
Since I posted I found some formulas that I incorporated. This code seems to be doing the trick:
var quat = this.entity.getRotation();
var x = quat.x;
var y = quat.y;
var z = quat.z;
var w = quat.w;
var 3 = new pc.Vec3( 2 * (x * z + w * y), 2 * (y * z - w * x), 1 - 2 * (x * x + y * y));
this.entity.translate(v3.x,v3.y,v3.z);