mirror of
https://github.com/haselkern/Minecraft-ArmorStand.git
synced 2025-05-17 15:05:33 +00:00
Make convertRotation more concise
This commit is contained in:
parent
f05e8a383c
commit
b5e6e7f18a
1 changed files with 5 additions and 6 deletions
|
@ -125,13 +125,12 @@ export default {
|
|||
convertRotation(mcRotation) {
|
||||
const DEG2RAD = Math.PI / 180
|
||||
|
||||
let matX = new Matrix4().makeRotationAxis(new Vector3(1, 0, 0), mcRotation.x * DEG2RAD)
|
||||
let matY = new Matrix4().makeRotationAxis(new Vector3(0, 1, 0), -mcRotation.y * DEG2RAD)
|
||||
matY.multiply(matX)
|
||||
let matZ = new Matrix4().makeRotationAxis(new Vector3(0, 0, 1), -mcRotation.z * DEG2RAD)
|
||||
matZ.multiply(matY)
|
||||
let rotationMatrix = new Matrix4()
|
||||
.multiply(new Matrix4().makeRotationAxis(new Vector3(0, 0, 1), -mcRotation.z * DEG2RAD))
|
||||
.multiply(new Matrix4().makeRotationAxis(new Vector3(0, 1, 0), -mcRotation.y * DEG2RAD))
|
||||
.multiply(new Matrix4().makeRotationAxis(new Vector3(1, 0, 0), mcRotation.x * DEG2RAD))
|
||||
|
||||
return new Euler().setFromRotationMatrix(matZ).toVector3()
|
||||
return new Euler().setFromRotationMatrix(rotationMatrix).toVector3()
|
||||
}
|
||||
},
|
||||
components: { Box, Camera, LambertMaterial, Renderer, Scene, Object3D },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue