import meshes.js 850 B

1234567891011121314151617181920212223
  1. var createScene = function () {
  2. var scene = new BABYLON.Scene(engine);
  3. //Adding a light
  4. var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(20, 20, 100), scene);
  5. //Adding an Arc Rotate Camera
  6. var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0.8, 100, BABYLON.Vector3.Zero(), scene);
  7. camera.attachControl(canvas, false);
  8. // The first parameter can be used to specify which mesh to import. Here we import all meshes
  9. BABYLON.SceneLoader.ImportMesh("", "scenes/", "skull.babylon", scene, function (newMeshes) {
  10. // Set the target of the camera to the first imported mesh
  11. camera.target = newMeshes[0];
  12. });
  13. // Move the light with the camera
  14. scene.registerBeforeRender(function () {
  15. light.position = camera.position;
  16. });
  17. return scene;
  18. }