diff --git a/qi81k80v08.js b/qi81k80v08.js index ee2997e..8f4c342 100644 --- a/qi81k80v08.js +++ b/qi81k80v08.js @@ -75,13 +75,19 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) { var velocity = null; - var rotX = Math.floor((Math.random() * 10) + 1) * 0.01; - var rotY = Math.floor((Math.random() * 10) + 1) * 0.01; - var rotZ = Math.floor((Math.random() * 10) + 1) * 0.01; + var axisX = GameLib.Utils.GetRandomIntIncluse(1,10) * 0.1; + var axisY = GameLib.Utils.GetRandomIntIncluse(1,10) * 0.1; + var axisZ = GameLib.Utils.GetRandomIntIncluse(1,10) * 0.1; + + var angle = GameLib.Utils.GetRandomIntIncluse(1,100) * 0.001; + var position = {x : 0, y: y, z :0}; - var rotation = {x : rotX, y: rotY, z: rotZ}; + var rotation = { + axis : {x : axisX, y: axisY, z: axisZ}, + angle : angle + }; var enemy = { mesh : mesh @@ -121,9 +127,11 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) { enemy.mesh.position.z = position.z; enemy.mesh.updateInstancePosition(); - enemy.mesh.rotation.x = rotation.x; - enemy.mesh.rotation.y = rotation.y; - enemy.mesh.rotation.z = rotation.z; + enemy.mesh.useQuaternion = true; + enemy.mesh.quaternion.axis.x = rotation.axis.x; + enemy.mesh.quaternion.axis.y = rotation.axis.y; + enemy.mesh.quaternion.axis.z = rotation.axis.z; + enemy.mesh.quaternion.angle = rotation.angle; enemy.mesh.updateInstanceRotation(); enemy.velocity = velocity; @@ -150,7 +158,7 @@ this.enemies = this.enemies.reduce( enemy.mesh.position.add(enemy.velocity); enemy.mesh.updateInstancePosition(); - enemy.mesh.rotation.add(enemy.rotation); + enemy.mesh.quaterion.angle.add(enemy.rotation.angle); enemy.mesh.updateInstanceRotation(); enemy.lifeTime += data.delta;