PhysicsGenerator Class
Physics generator is used to create Cannon.js shapes from three.js geometries.
Can be used with any object that contains a geometry.
It is based on the original Mesh2Shape converted by @donmccurdy.
Item Index
Methods
Attributes
Methods
createBoundingBoxShape
-
geometry
Bounding box needs to be computed with the entire mesh, not just geometry.
Parameters:
-
geometry
Geometry
Returns:
shape
createBoundingCylinderShape
-
object
Create cylinder shape from bounding cylinder calculated from bounding box and bouding sphere.
Parameters:
-
object
Object3D
Returns:
shape
createBoundingSphereShape
-
geometry
Sphere shape from bouding sphere.
Parameters:
-
geometry
Geometry
Returns:
shape
createBoxShape
-
geometry
Create box shape from geometry.
Parameters:
-
geometry
Geometry
Returns:
shape
createConvexPolyhedron
-
geometry
Computes 3D convex hull as a ConvexPolyhedron.
Parameters:
-
geometry
ConvexPolyhedron
Returns:
shape
createCylinderShape
-
geometry
Create cylinder shape from geometry.
Parameters:
-
geometry
Geometry
Returns:
shape
createPlaneShape
-
geometry
Plane shape from geometry.
Parameters:
-
geometry
Geometry
Returns:
shape
createShape
-
object
-
type
Given a Object3D instance, creates a corresponding CANNON shape.
Parameters:
-
object
Object3D -
type
StringPhysicsGenerator.Type
Returns:
shape
createSphereShape
-
geometry
Sphere shape from geometry.
Parameters:
-
geometry
Geometry
Returns:
shape
createTrimeshShape
-
geometry
Trimesh shape from geometry.
Parameters:
-
geometry
Geometry
Returns:
shape
createTubeShape
-
geometry
Sphere shape from bouding sphere.
Parameters:
-
geometry
Geometry
Returns:
shape
getGeometry
-
object
Returns a single geometry for the given object.
If the object is compound, its geometries are automatically merged.
Parameters:
-
object
Object3D
Returns:
Geometry that contains all merger geometry
getMeshes
-
object
Returns a array of Mesh instances from the given object.
If nested transformations are found, they are applied to child meshes as mesh.userData.matrix, so that each mesh has its position/rotation/scale independently of all of its parents except the top-level object.
Parameters:
-
object
Object3D
Returns:
meshes found inside the Object3D
getVertices
-
geometry
Get geometry vertices.
Parameters:
-
geometry
Geometry
Returns:
array