Skip to content

Commit 4c37978

Browse files
committed
🚧 Fix #211
1 parent c0df525 commit 4c37978

File tree

5 files changed

+1596
-1016
lines changed

5 files changed

+1596
-1016
lines changed

src/systems/animationRenderer.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,8 @@ function getDecomposedTransformation(matrix: THREE.Matrix4) {
4949
}
5050

5151
function threeAxisRotationToTwoAxisRotation(rot: THREE.Quaternion): ArrayVector2 {
52-
const euler = Reusable.vec3.applyQuaternion(rot)
53-
const yaw = Math.atan2(euler.z, euler.x)
54-
const pitch = Math.atan2(euler.y, euler.z)
55-
return [Math.radToDeg(yaw), Math.radToDeg(pitch)]
52+
const euler = new THREE.Euler().setFromQuaternion(rot, 'YXZ')
53+
return [Math.radToDeg(-euler.x), Math.radToDeg(-euler.y) + 180]
5654
}
5755

5856
export interface INodeTransform {

src/systems/datapackCompiler/animation.mcb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,8 @@ dir <%export_namespace%> {
410410
posx: node.pos[0],
411411
posy: node.pos[1],
412412
posz: node.pos[2],
413-
rotx: node.rot[0],
414-
roty: node.rot[1]
413+
rotx: node.head_rot[1],
414+
roty: node.head_rot[0]
415415
}
416416
%%>
417417
}
@@ -421,8 +421,8 @@ dir <%export_namespace%> {
421421
^<%roundTo(node.pos[1], 10)%> \
422422
^<%roundTo(node.pos[2], 10)%> \
423423
rotated \
424-
~<%roundTo(node.head_rot[0], 10)%> \
425424
~<%roundTo(node.head_rot[1], 10)%> \
425+
~<%roundTo(node.head_rot[0], 10)%> \
426426
run {
427427
<%%
428428
emit.mcb(node.commands)

0 commit comments

Comments
 (0)