Skip to content

Instantly share code, notes, and snippets.

@fmnxl
Last active April 20, 2017 17:39
Show Gist options
  • Save fmnxl/e7d706645c01b8f813d6ac101a49ea52 to your computer and use it in GitHub Desktop.
Save fmnxl/e7d706645c01b8f813d6ac101a49ea52 to your computer and use it in GitHub Desktop.
Creating a Cannon.Body and adding it into a Cannon.World
// Create a World
var world = new CANNON.World()
// Create a Body
var mass = 1
var radius = 1
var position = new CANNON.Vec3(0, 0, -3)
var shape = new CANNON.Sphere(radius)
var body = new CANNON.Body({ mass, position, shape })
// Add the body to the world
world.addBody(body)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment