Shit
I tried that:
tm = this.vehicleController.getWheelTransform(i);
p = tm.getOrigin();
q = tm.getRotation();
this.wheelTransforms[i].position.set(p.x(), p.y(), p.z());
this.wheelTransforms[i].rotationQuaternion.set(q.x(), q.y(), q.z(), q.w());
this.wheelTransforms[i].rotationQuaternion.multiplyInPlace(BABYLON.Quaternion.RotationYawPitchRoll(0, Math.PI, 0));
My Wheels are still flipped the wrong way…
Should look like this:
But the wheel positions that are getting set from a btTransform i Physics World… flips it to this:
I tried the code which should just flip the transform around… but it does not
Code is pretty simple… Each Frame…
Iterate wheel info… update the in internal wheel info… get the updated world transform and apply that position and rotation to the actual wheel meshes (TansformNode)… so the wheels can turn and bounces up and down with the suspension handling
protected after(): void {
if (this.wheelTransforms != null && this.wheelTransforms.length >= 4) {
let tm:any, p:any, q:any, i:number;
const n = this.vehicleController.getNumWheels();
for (i = 0; i < n; i++) {
this.vehicleController.updateWheelTransform(i, true);
tm = this.vehicleController.getWheelTransform(i);
p = tm.getOrigin();
q = tm.getRotation();
this.wheelTransforms[i].position.set(p.x(), p.y(), p.z());
this.wheelTransforms[i].rotationQuaternion.set(q.x(), q.y(), q.z(), q.w());
this.wheelTransforms[i].rotationQuaternion.multiplyInPlace(BABYLON.Quaternion.RotationYawPitchRoll(0, Math.PI, 0));
}
}
}