// Cloned by John Lasis on 3 Dec 2022 from World "One Cube World (Three.js)" by Starter user
// Please leave this clone trail here.
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
const renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
// const geometry = new THREE.BoxGeometry( 1, 1, 1 );
// const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
// const cube = new THREE.Mesh( geometry, material );
// scene.add( cube );
const skycolor = 'black';
camera.position.z = 5;
function loadModels()
{
const loader = new THREE.GLTFLoader();
const onLoad = ( gltf, position ) =>
{
const model = gltf.scene.children[ 0 ];
model.position.copy( position );
const animation = gltf.animations[ 0 ];
const mixer = new THREE.AnimationMixer( model );
mixers.push( mixer );
const action = mixer.clipAction( animation );
action.play();
ABWorld.scene.add( model );
};
const squidDoll = new THREE.Vector3 ( 0, 0, 50 );
// can load 3D models of other user:
loader.load ( '/uploads/john90/squidDoll.glb', gltf => onLoad ( gltf, squidDoll ) );
}
renderer.render(scene, camera);function animate() {
renderer.render( scene, camera );
cube.rotation.x += 0.05;
requestAnimationFrame( animate );
}
animate();
// Define what the World does at the start of a run:
AB.world.newRun = function()
{
// start a 3D scene:
ABWorld.init3d ( geometry, material, skycolor );
// add the object to the scene:
ABWorld.scene.add ( renderer.render );
};