Sphere class

Spherical shape @example const radius = 1 const sphereShape = new CANNON.Sphere(radius) const sphereBody = new CANNON.Body({ mass: 1, shape: sphereShape }) world.addBody(sphereBody)

Inheritance

Constructors

Sphere([double radius = 1.0])
@param radius The radius of the sphere, a non-negative number.

Properties

body Body?
The body to which the shape is added to.
getter/setter pairinherited
boundingSphereRadius double
The local bounding sphere radius of this shape.
getter/setter pairinherited
collisionFilterGroup int
getter/setter pairinherited
collisionFilterMask int
getter/setter pairinherited
collisionResponse bool
Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled.
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
id int
Identifier of the Shape.
getter/setter pairinherited
material Material?
Optional material of the shape that regulates contact properties.
getter/setter pairinherited
radius double
The radius of the sphere.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type ShapeType
The type of this shape. Must be set to an int > 0 by subclasses.
getter/setter pairinherited

Methods

calculateLocalInertia(num mass, [Vec3? target]) Vec3
Calculates the inertia in the local frame for this shape. @see http://en.wikipedia.org/wiki/List_of_moments_of_inertia
override
calculateWorldAABB(Vec3 pos, Quaternion quat, Vec3 min, Vec3 max) → void
@todo use abstract for these kind of methods
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
updateBoundingSphereRadius() → void
Computes the bounding sphere radius. The result is stored in the property .boundingSphereRadius
override
volume() double
Get the volume of this shape
override

Operators

operator ==(Object other) bool
The equality operator.
inherited