PhysicsObject Class

Extends Group
Module: Physics

Wrapper for cannon.js physics objects.

The editor includes tools to create cannon shapes from three.js geometry objects.

Documentation for cannon.js physics available here http:// schteppe.github.io/cannon.js/docs/

Item Index

Attributes

Methods

addShape

(
  • shape
)

Add shape to physics object body.

Parameters:

  • shape Shape

initialize

()

Intialize physics object and add it to the scene physics world.

update

()

Update object position and rotation based on cannon.js body.

Attributes

body

Body

Physics body contains the following attributes:

  • position Vec3
  • velocity Vec3
  • torque Vec3
  • angularVelocity Vec3
  • quaternion Quaternion
  • mass Number
  • material Material
  • type Number
  • linearDamping Number
  • angularDamping Number
  • allowSleep Boolean
  • sleepSpeedLimit Number
  • sleepTimeLimit Number
  • collisionFilterGroup Number
  • collisionFilterMask Number
  • fixedRotation Boolean
  • shape Array

LOCAL

Number static

The position of the object is copied directly from the body.

Ignores the world tranforms inherited from parent objects.

Faster but the physics object should not carry any world transformations.

mode

Number

Physics object position mode, indicates how coordinates from the physics engine are transformed into object coordinates.

world

World

Refenrece to the physics world.

WORLD

Number static

The position of the object is adjusted to follow the parent object transformation.

This mode should be used for objects placed inside others.