Skip to content

Latest commit

 

History

History
69 lines (50 loc) · 2.23 KB

README.md

File metadata and controls

69 lines (50 loc) · 2.23 KB

threex.cannonjs

threex.cannonjs is a threex game extension for three.js. It provides realistic physics easy to include in your own games. So you can take object in your game and make them fall as if it was the real world! You can code a pool game in a day! You make rocks falls from the sky in a realistic fasion! Sky is the limit! It is a warper over the excelent library cannon.js physics library. It has been written by Stefan Hedman or @schteppe on twitter.

Show Don't Tell

A Screenshot

screenshot

How To Install It

You can install it manually. Just do

<script src='threex.cannonjs.js'></script>

You can install with bower.

bower install threex.cannonjs

then you add that in your html

<script src="bower_components/threex.cannonjs/threex.cannonjs.js"></script>

How To Install it ?

Init the physics world

var worldx	= new THREEx.CannonWorld().start();

create a physics body from a THREE.Mesh

var bodyx	= new THREEx.CannonBody(mesh)

add this physics body to our physics world and keep updating it

worldx.add(bodyx)
updateFcts.push(function(delta, now){
	bodyx.update(delta, now);		
});

one may wish to setup an initial velocity

bodyx.body.angularVelocity.set(0,2,0);