I'm currently attempting to create a 3D object that rotates continuously on any axis, similar to a classic cube or sphere. However, I'm encountering an issue where the object is not moving at all and I'm unsure why. Here is the code I'm using:
var scene6, camera6, renderer6, light, shipMtl, shipObj;
function init() {
scene6 = new THREE.Scene();
camera6 = new THREE.PerspectiveCamera(35, 1, 1, 1000);
camera6.position.z = 400;
//LIGHTS
light = new THREE.PointLight(0xffffff, 2, 0);
light.position.set(200, 100, 300);
scene6.add(light);
//3D MODEL
shipMtl = new THREE.MTLLoader();
shipMtl.load('../models/spaceCraft1.mtl', function(materials) {
materials.preload();
shipObj = new THREE.OBJLoader();
shipObj.setMaterials(materials);
shipObj.load('../models/spaceCraft1.obj', function(object) {
object.scale.set(10, 10, 10);
object.rotation.x += .01;
scene6.add(object);
});
});
renderer6 = new THREE.WebGLRenderer({ canvas: document.getElementById('model'), antialias: true });
renderer6.setClearColor(0x000000);
renderer6.setPixelRatio(window.devicePixelRatio);
animate6();
}
function animate6() {
requestAnimationFrame(animate6);
renderer6.render(scene6, camera6);
}
window.onload = init;
Any assistance you can provide would be greatly appreciated.