1234567891011121314151617181920212223 |
- var createScene = function () {
- var scene = new BABYLON.Scene(engine);
- //Adding a light
- var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(20, 20, 100), scene);
- //Adding an Arc Rotate Camera
- var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0.8, 100, BABYLON.Vector3.Zero(), scene);
- camera.attachControl(canvas, false);
- // The first parameter can be used to specify which mesh to import. Here we import all meshes
- BABYLON.SceneLoader.ImportMesh("", "scenes/", "skull.babylon", scene, function (newMeshes) {
- // Set the target of the camera to the first imported mesh
- camera.target = newMeshes[0];
- });
- // Move the light with the camera
- scene.registerBeforeRender(function () {
- light.position = camera.position;
- });
- return scene;
- }
|