summaryrefslogtreecommitdiff
path: root/help.html
diff options
context:
space:
mode:
authorJ08nY2016-04-16 19:37:06 +0200
committerJ08nY2016-04-16 19:37:06 +0200
commitecf1f78d2c83fdab789c9dd84819e12710b85d6c (patch)
treeb84953b2f66724c427507a809bfc70947363b3cf /help.html
parent32cdf45cba3b13831c6449e0ced66a49e0d99aa0 (diff)
downloadld35-ecf1f78d2c83fdab789c9dd84819e12710b85d6c.tar.gz
ld35-ecf1f78d2c83fdab789c9dd84819e12710b85d6c.tar.zst
ld35-ecf1f78d2c83fdab789c9dd84819e12710b85d6c.zip
finallly, figured out Physijs...
Diffstat (limited to 'help.html')
-rw-r--r--help.html61
1 files changed, 61 insertions, 0 deletions
diff --git a/help.html b/help.html
new file mode 100644
index 0000000..7b0405c
--- /dev/null
+++ b/help.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+ <script type="text/javascript" src="/three_js/dist/three.min.js"></script>
+ <script type="text/javascript" src="/physi_js/physi.js"></script>
+
+
+</head>
+
+<body>
+<div id="viewport"></div>
+
+<script type="text/javascript">
+
+ 'use strict';
+
+ Physijs.scripts.worker = '/physi_js/physijs_worker.js';
+ Physijs.scripts.ammo = '/physi_js/ammo.js';
+
+ var initScene, render, renderer, scene, camera, box;
+
+ initScene = function() {
+ renderer = new THREE.WebGLRenderer({ antialias: true });
+ renderer.setSize( window.innerWidth, window.innerHeight );
+ document.getElementById( 'viewport' ).appendChild( renderer.domElement );
+
+ scene = new Physijs.Scene;
+
+ camera = new THREE.PerspectiveCamera(
+ 35,
+ window.innerWidth / window.innerHeight,
+ 1,
+ 1000
+ );
+ camera.position.set( 60, 50, 60 );
+ camera.lookAt( scene.position );
+ scene.add( camera );
+
+ // Box
+ box = new Physijs.BoxMesh(
+ new THREE.CubeGeometry( 5, 5, 5 ),
+ new THREE.MeshBasicMaterial({ color: 0x888888 })
+ );
+ scene.add( box );
+
+ requestAnimationFrame( render );
+ };
+
+ render = function() {
+ box.applyCentralForce(new THREE.Vector3(1,0,0));
+ scene.simulate(); // run physics
+ renderer.render( scene, camera); // render the scene
+ requestAnimationFrame( render );
+ };
+
+ window.onload = initScene();
+
+</script>
+</body>
+</html> \ No newline at end of file