Last active
August 26, 2018 19:56
-
-
Save flushpot1125/952f21c40346b2894658043f31d930f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Default .babylon loading scene</title> | |
<meta charset="UTF-8"> | |
<script src="https://preview.babylonjs.com/babylon.js"></script> | |
<script src="https://preview.babylonjs.com/loaders/babylonjs.loaders.js"></script> | |
<style> | |
html, body {overflow: hidden; width: 100%; height: 100%; margin: 0; padding: 0;font-family: OpenSans, tahoma, arial, sans-serif;color:white;} | |
#canvas {width: 100%; height: 100%; touch-action: none;} | |
</style> | |
</head> | |
<body> | |
<canvas id="canvas"></canvas> | |
<script type="text/javascript"> | |
//based on "http://www.gamefromscratch.com/post/2017/02/06/BabylonJS-Tutorial-Series-3D-Models.aspx" | |
//based on "https://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons" | |
var canvas = document.getElementById('canvas'); | |
var engine = new BABYLON.Engine(canvas, true); | |
engine.enableOfflineSupport = false; // Dont require a manifest file | |
var createScene = function(){ | |
var scene = new BABYLON.Scene(engine); | |
scene.clearColor = new BABYLON.Color3.White(); | |
var camera = new BABYLON.ArcRotateCamera("arcCam",BABYLON.Tools.ToRadians(0),BABYLON.Tools.ToRadians(0),10.0,BABYLON.Vector3.Zero(),scene); | |
camera.attachControl(canvas,true); | |
var light = new BABYLON.PointLight("PointLight",new BABYLON.Vector3(0,0,0),scene); | |
light.parent = camera; | |
light.intensity = 1.5; | |
var rotobMesh; | |
var robotSkelton; | |
BABYLON.SceneLoader.ImportMesh("","","g.babylon", | |
scene,function(newMeshes,particleSystems,skeltons) { | |
newMeshes.forEach(function(mesh){mesh.rotation = new BABYLON.Vector3(BABYLON.Tools.ToRadians(0),0,0);}); | |
robotMesh = newMeshes[0]; | |
robotSkelton = skeltons[0]; | |
scene.beginAnimation(robotSkelton, 0, 100, true, 1.0);//skeltons[0] did not worked, but robotSkelton works. | |
}); | |
return scene; | |
} | |
var scene = createScene(); | |
engine.runRenderLoop(function() {scene.render();}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment