Physijs - A Physics Plugin For Three.js
Join the DZone community and get the full member experience.
Join For Free
physijs
brings a very easy to use interface to the three.js framework. one of
the reasons three.js is so popular is because it is so incredibly easy
for graphics newbies to get into 3d programming. physijs takes that
philosophy to heart and makes physics simulations just as easy to run.
in fact, there are just five easy steps that must be taken to make a 3d
scene come alive.
how does physijs work?
physijs is built on top of ammo.js (although there is also a cannon.js
branch) and runs the physics simulation in a separate thread (via web
worker) to avoid impacting in your application's performance and taking
up your your 3d rendering time.
a lot of effort has been made to keep the style of code the same when using physijs. apart from updating an object's position, all of the normal three.js conventions remain the same. if you are used to three.js, you already know how to use the physijs plugin.
who is this for?
you, hopefully. if you are familiar with three.js and want to add
physics to your scene, this is the plugin for you. no mucking about with
shape definitions, keeping objects in their correct positions, or
identifying collisions - simply use a few physijs objects in place of
three.js's and you'll automatically have a dynamic environment.
if you need (or want) a feature not already included then add it to the issue tracker or implement it yourself and send over a pull request.
features
requirements : d3.js
demo : http:/ / chandlerprall. github. com/ physijs/ examples/ body. html
license : mit license
how does physijs work?
physijs is built on top of ammo.js (although there is also a cannon.js
branch) and runs the physics simulation in a separate thread (via web
worker) to avoid impacting in your application's performance and taking
up your your 3d rendering time.
a lot of effort has been made to keep the style of code the same when using physijs. apart from updating an object's position, all of the normal three.js conventions remain the same. if you are used to three.js, you already know how to use the physijs plugin.
who is this for?
you, hopefully. if you are familiar with three.js and want to add
physics to your scene, this is the plugin for you. no mucking about with
shape definitions, keeping objects in their correct positions, or
identifying collisions - simply use a few physijs objects in place of
three.js's and you'll automatically have a dynamic environment.
if you need (or want) a feature not already included then add it to the issue tracker or implement it yourself and send over a pull request.
features
- support for multiple object shapes, including custom convex objects.
- material system provides simple control over friction and restitution ("bounciness")
- integrated collision detection and events
- compound objects using the hierarchy system in three.js
- rotations using either euler or quaternion systems - your preference
- built seamlessly on top of three.js to keep the same convention and coding style

requirements : d3.js
demo : http:/ / chandlerprall. github. com/ physijs/ examples/ body. html
license : mit license
Object (computer science)
MIT License
Collision detection
Collision (computer science)
application
GitHub
Requests
Opinions expressed by DZone contributors are their own.
Comments