The body to which the shape is added to.
The local bounding sphere radius of this shape.
1
-1
Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled.
true
faceNormals
Array of integer arrays, indicating which vertices each face consists of
Identifier of the Shape.
Optional material of the shape that regulates contact properties.
The type of this shape. Must be set to an int > 0 by subclasses.
If given, these locally defined, normalized axes are the only ones being checked when doing separating axis check.
uniqueEdges
vertices
worldFaceNormals
worldFaceNormalsNeedsUpdate
worldVertices
worldVerticesNeedsUpdate
Static
idStatic
typesAll the Shape types.
Readonly
BOX: 4BOX
Readonly
COMPOUND: 8COMPOUND
Readonly
CONVEXPOLYHEDRON: 16CONVEXPOLYHEDRON
Readonly
CYLINDER: 128CYLINDER
Readonly
HEIGHTFIELD: 32HEIGHTFIELD
Readonly
PARTICLE: 64PARTICLE
Readonly
PLANE: 2PLANE
Readonly
SPHERE: 1SPHERE
Readonly
TRIMESH: 256TRIMESH
calculateLocalInertia
calculateWorldAABB
Clamp distance
The an array of contact point objects, see clipFaceAgainstHull
Clip a face against a hull.
An array of Vec3 with vertices in the world frame.
Distance clamping
Updates worldVertices
and sets worldVerticesNeedsUpdate
to false.
Updates .worldVertices
and sets .worldVerticesNeedsUpdate
to false.
Find the separating axis between this hull and another
The target vector to save the axis in
Optional
faceListA: number[]Optional
faceListB: number[]Returns false if a separation is found, else true
Compute the normal of a face from its vertices
Checks whether p is inside the polyhedra. Must be in local coords. The point lies outside of the convex hull of the other points if and only if the direction of all the vectors from it to those other points are on less than one half of a sphere around it.
A point given in local coordinates
Test separating axis against two hulls. Both hulls are projected onto the axis and the overlap size is returned if there is one.
The overlap depth, or FALSE if no penetration.
Transform all local points. Will change the .vertices
Static
computeStatic
projectGet max and min dot product of a convex hull at position (pos,quat) projected onto an axis. Results are saved in the array maxmin.
result[0] and result[1] will be set to maximum and minimum, respectively.
A set of polygons describing a convex shape.
The shape MUST be convex for the code to work properly. No polygons may be coplanar (contained in the same 3D plane), instead these should be merged into one polygon.
Author
qiao / https://github.com/qiao (original author, see https://github.com/qiao/three.js/commit/85026f0c769e4000148a67d45a9e9b9c5108836f)
Author
schteppe / https://github.com/schteppe
See
https://www.altdevblogaday.com/2011/05/13/contact-generation-between-3d-convex-meshes/
Todo
Move the clipping functions to ContactGenerator?
Todo
Automatically merge coplanar polygons in constructor.
Example