1
0
Fork 0
mirror of https://github.com/haselkern/Minecraft-ArmorStand.git synced 2025-05-18 05:55:35 +00:00

Add first version of armorstand class

This commit is contained in:
Lars Martens 2021-08-11 23:01:26 +02:00
parent e46ba54aac
commit dab3e20310
6 changed files with 101 additions and 16 deletions

View file

@ -4,7 +4,7 @@
<Scene>
<AmbientLight :intensity="0.3" />
<DirectionalLight :intensity="1" :position="{ x: 10, y: 9 }" />
<Box ref="box" :rotation="{ y: rot / Math.PI / 4 }">
<Box ref="box" :rotation="scaledRotation">
<LambertMaterial />
</Box>
</Scene>
@ -13,10 +13,10 @@
<script>
import { Box, Camera, LambertMaterial, AmbientLight, Renderer, Scene } from 'troisjs';
import { Box, Camera, LambertMaterial, AmbientLight, Renderer, Scene } from "troisjs";
export default {
props: ["rot"],
props: ["armorstand"],
mounted() {
// const renderer = this.$refs.renderer
// const box = this.$refs.box.mesh
@ -24,6 +24,15 @@ export default {
// box.rotation.x += 0.01
// })
},
computed: {
scaledRotation: function() {
return {
x: this.armorstand.head.x / 180 * Math.PI,
y: this.armorstand.head.y / 180 * Math.PI,
z: this.armorstand.head.z / 180 * Math.PI,
}
}
},
components: { Box, Camera, LambertMaterial, Renderer, Scene },
}
</script>