topical media & game development
mobile-query-three-plugins-physics-examples-index.sos.htm / htm
<!doctype html><title>Minimal tQuery Page</title>
<script src="./tquery-bundle.js"></script>
<script src="../../physi.js"></script>
<body><script>
var world = tQuery.createWorld().boilerplate().start();
world.tCamera().translateZ(-100);
Physijs.scripts.worker = '../../physijs_worker.js';
Physijs.scripts.ammo = 'examples/js/ammo.js';
var tScene = world.tScene();
console.assert(tScene._xScene === undefined)
tScene._xScene = new Physijs.xScene();
var tMaterial = new THREE.MeshNormalMaterial()
console.assert(tMaterial._physijs === undefined)
//tMaterial._xMaterial = new Physijs.xMaterial(tMaterial, friction, restitution)
tMaterial._xMaterial = new Physijs.xMaterial(tMaterial, .8, .5);
tMaterial._physijs = tMaterial._xMaterial._physijs;
var object = tQuery.createCube(tMaterial)
.geometry().scaleBy(4, 4, 4).back()
.translateY(+15)
.addTo(world);
var tMesh = object.get(0);
tMesh.rotation.x= Math.random()*Math.PI*2;
tMesh.rotation.y= Math.random()*Math.PI*2;
tMesh.rotation.z= Math.random()*Math.PI*2;
console.assert(tMesh._xMesh === undefined)
console.assert(tMesh._physijs === undefined)
tMesh._xMesh = new Physijs.xMesh(tMesh.geometry, 0)
tMesh._physijs = tMesh._xMesh._physijs;
tMesh._xMesh._boxGeometryInit(tMesh.geometry)
tScene._xScene.add( tMesh, function(){
console.log("this tMesh has been added")
});
var object = tQuery.createCube(tMaterial)
.geometry().scaleBy(100, 1, 100).back()
.translateY(-10)
.addTo(world);
var tMesh = object.get(0);
console.assert(tMesh._xMesh === undefined)
console.assert(tMesh._physijs === undefined)
tMesh._xMesh = new Physijs.xMesh(tMesh.geometry, 0)
tMesh._physijs = tMesh._xMesh._physijs;
tMesh._xMesh._boxGeometryInit(tMesh.geometry, 0)
tScene._xScene.add( tMesh, function(){
console.log("this tMesh has been added")
})
world.loop().hook(function(){
tScene._xScene.simulate(2*1/60, 2);
});
</script></body>
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.