• Stars
    star
    2,760
  • Rank 16,503 (Top 0.4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 12 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Physics plugin for Three.js

Physijs

Physics plugin for three.js

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 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.

Examples

rigid bodies collisions compound shapes all shapes jenga car constraints vehicle

Features

  • Support for multiple object shapes, including custom convex or concave objects as well as heightmaps
  • Material system provides simple control over friction and restitution ("bounciness")
  • Integrated collision detection and events
  • Compound objects using the hierarchy system in three.js
  • Vehicle system
  • Constraint systems such as point-to-point and hinge
  • Rotations using either euler or quaternion systems - your preference
  • Built seamlessly on top of three.js to keep the same convention and coding style

In the Future

  • More (and better) optimizations
  • It would be awesome to have concave shape decomposition

More Repositories

1

ThreeCSG

CSG plugin for Three.js
JavaScript
453
star
2

GoblinPhysics

Collision Detection & Response in JavaScript
JavaScript
147
star
3

FamilyTreeJS

Easy programmatic creation & display of family trees through Javascript.
JavaScript
48
star
4

shrine

Boilerplate monorepo for modular JavaScript development
JavaScript
17
star
5

insula

State management library for JavaScript
JavaScript
13
star
6

collision-detection

JavaScript library for 3D collision detection
JavaScript
11
star
7

AutoshapeJS

JavaScript
8
star
8

react-insula

Connects Insula's state management into React views
JavaScript
7
star
9

Mindless

My entry for the js13k competition
7
star
10

Freeciv-Engine

WebGL engine for Freeciv.net
JavaScript
7
star
11

DatabindExtension

One-way databinding extension for Nunjucks templating engine
JavaScript
5
star
12

multiplayer-pacman

JavaScript
4
star
13

defensegame

A minimal tower defense game created for Develop Denver 2013.
JavaScript
4
star
14

unwordle

wordle solver, as both a CLI util and automated via puppeteer
JavaScript
3
star
15

GameFramework

A game framework built on Goblin Physics, three.js, and React
JavaScript
3
star
16

js-in-scss

Experiment to process SCSS into a JS runtime for applying variable overrides
TypeScript
3
star
17

WebWorkerJoining

exploring how to "join" on web workers, delaying code execution until all workers have finished
JavaScript
3
star
18

with-eui

boilerplate repo with EUI
JavaScript
3
star
19

sagebrush

experimental language & syntax parser
CSS
2
star
20

insula-stringselectors

Insula middleware that allows using strings as state selectors
JavaScript
2
star
21

HighPerformanceJavaScriptIntro

Intro for Develop Denver 2015 talk
JavaScript
1
star
22

sagebrush-engine

TypeScript
1
star
23

node-process-com-benchmark

testing how many JSON messages / bandwidth I can pass between node processes on a host machine
JavaScript
1
star
24

OneGameAMonth

My entires for http://www.onegameamonth.com/
JavaScript
1
star
25

chandlerprall.com

JavaScript
1
star
26

vena

TypeScript
1
star
27

explosive-markdown

Adding physics to rendered markdown for fun a̶n̶d̶ ̶p̶r̶o̶f̶i̶t̶
JavaScript
1
star