Hi Cameni!
I am faced with a situation that does not call it a problem, but!
I create the visual effect of inertia camera in a vehicle.
The code block
/// camera
if (this.get_camera_mode() == 0) {
var seatBone = this.player.points[this.player.seatCam].seatBone;
// lateral inertia
var inertiaY = clamp(
interpolate(velocity.angular.y, -Math.PI, Math.PI, -1, 1) + interpolate(velocity.linear.x, -6, 6, -1, 1),
-1, 1
);
this.geom.rotate_joint_orig(seatBone, -.35 * inertiaY, {x:0, y:1, z:0});
//this.geom.rotate_joint_orig(seatBone, -.35 * inertiaY, {y:1}); // so I also tried
// inertia acceleration and braking
var inertiaX = clamp(
interpolate_table(velocity.linear.y * (-brake || engine), [-4, 0, 4], [-.15, 0, .075]),
-.15, .075
);
this.geom.rotate_joint_orig(seatBone, inertiaX, {x:1, y:0, z:0});
//this.geom.rotate_joint_orig(seatBone, inertiaX, {x:1});
}
Running a block of code "inertia acceleration and braking" cancels the changes made by the "lateral inertia" in the code block.
I understand what you can do X and Y their bones, it seems to me not very profitable.
Maybe it makes sense to slightly change the algorithm of the method?
var valX = expression;
var valY = expression;
var valZ = expression;
this.geom.rotate_joint_orig(bone, {x:valX, y:valY, z:valZ});
Or so.
Change their values only listed axis.
this.geom.rotate_joint_orig(bone, value, {x:1});