根据鼠标的移动旋转cube。
1赞
Quat.rotateAround
/**
* @zh 绕世界空间下指定轴旋转四元数
* @param axis 旋转轴,默认已归一化
* @param rad 旋转弧度
*/
public static rotateAround <Out extends IQuatLike, VecLike extends IVec3Like> (out: Out, rot: Out, axis: VecLike, rad: number) {
// get inv-axis (local to rot)
Quat.invert(qt_1, rot);
Vec3.transformQuat(v3_1, axis, qt_1);
// rotate by inv-axis
Quat.fromAxisAngle(qt_1, v3_1, rad);
Quat.multiply(out, rot, qt_1);
return out;
}
1赞