8000 Wrong conversion between `Quaternion` and `Euler` · Issue #1849 · galacean/engine · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Wrong conversion between Quaternion and Euler #1849
Closed
@cptbtptpbcptdtptp

Description

@cptbtptpbcptdtptp

image

Demo:

import { MathUtil, Quaternion, Vector3, WebGLEngine } from "@galacean/engine";
WebGLEngine.create({ canvas: "canvas" }).then((engine) => {
  const quaternion = new Quaternion(0.5, 0.5, 0.5, -0.5);
  const rotation = new Vector3();
  quaternion.toEuler(rotation).scale(MathUtil.radToDegreeFactor);
  console.log(
    "quaternion:",
    quaternion.x,
    quaternion.y,
    quaternion.z,
    quaternion.w,
    " -> rotation:",
    rotation.x,
    rotation.y,
    rotation.z
  );
  Quaternion.rotationEuler(
    MathUtil.degreeToRadian(rotation.x),
    MathUtil.degreeToRadian(rotation.y),
    MathUtil.degreeToRadian(rotation.z),
    quaternion
  );
  console.log(
    "rotation:",
    rotation.x,
    rotation.y,
    rotation.z,
    " -> quaternion:",
    quaternion.x,
    quaternion.y,
    quaternion.z,
    quaternion.w
  );
});

Metadata

Metadata

Labels

mathMath library

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0