Cone class
Cone class. @example const radiusTop = 0.5 const radiusBottom = 0.5 const height = 2 const numSegments = 12 const ConeShape = new CANNON.Cone(radiusTop, radiusBottom, height, numSegments) const ConeBody = new CANNON.Body({ mass: 1, shape: ConeShape }) world.addBody(ConeBody)
- Inheritance
-
- Object
- Shape
- ConvexPolyhedron
- Cone
Constructors
Properties
- aabbmax → Vector3
-
finalinherited
- aabbmin → Vector3
-
finalinherited
- 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
-
faceNormals
↔ List<
Vector3?> -
getter/setter pairinherited
-
faces
↔ List<
List< int> > -
Array of integer arrays, indicating which vertices each face consists of
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- height ↔ double
-
The height of the Cone.
getter/setter pair
- id ↔ int
-
Identifier of the Shape.
getter/setter pairinherited
- material ↔ Material?
-
Optional material of the shape that regulates contact properties.
getter/setter pairinherited
- numSegments ↔ int
-
The number of segments to build the cone out of.
getter/setter pair
- radius ↔ double
-
The radius of the Cone.
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
-
uniqueAxes
↔ List<
Vector3> ? -
If given, these locally defined, normalized axes are the only ones being checked when doing separating axis check.
getter/setter pairinherited
-
uniqueEdges
↔ List<
Vector3> -
getter/setter pairinherited
-
vertices
↔ List<
Vector3> -
getter/setter pairinherited
-
worldFaceNormals
↔ List<
Vector3> -
getter/setter pairinherited
- worldFaceNormalsNeedsUpdate ↔ bool
-
getter/setter pairinherited
-
worldVertices
↔ List<
Vector3> -
getter/setter pairinherited
- worldVerticesNeedsUpdate ↔ bool
-
getter/setter pairinherited
Methods
-
calculateLocalInertia(
double mass, Vector3 target) → Vector3 -
Calculates the inertia in the local frame for this shape.
@see http://en.wikipedia.org/wiki/List_of_moments_of_inertia
inherited
-
calculateWorldAABB(
Vector3 pos, Quaternion quat, Vector3 min, Vector3 max) → void -
@todo use abstract for these kind of methods
inherited
-
clipAgainstHull(
Vector3 posA, Quaternion quatA, ConvexPolyhedron hullB, Vector3 posB, Quaternion quatB, Vector3 separatingNormal, double minDist, double maxDist, List< ConvexPolyhedronContactPoint> result) → void -
@param minDist Clamp distance
@param result The an array of contact point objects, see clipFaceAgainstHull
inherited
-
clipFaceAgainstHull(
Vector3 separatingNormal, Vector3 posA, Quaternion quatA, List< Vector3> worldVertsB1, double minDist, double maxDist, List<ConvexPolyhedronContactPoint> result) → void -
Clip a face against a hull.
@param worldVertsB1 An array of Vector3 with vertices in the world frame.
@param minDist Distance clamping
@param Array result Array to store resulting contact points in. Will be objects with properties: point, depth, normal. These are represented in world coordinates.
inherited
-
clipFaceAgainstPlane(
List< Vector3> inVertices, List<Vector3> outVertices, Vector3 planeNormal, double planeConstant) → List<Vector3> -
Clip a face in a hull against the back of a plane.
@param planeConstant The constant in the mathematical plane equation
inherited
-
computeEdges(
) → void -
Computes uniqueEdges
inherited
-
computeLocalAABB(
Vector3 aabbmin, Vector3 aabbmax) → void -
inherited
-
computeNormals(
) → void -
Compute the normals of the faces.
Will reuse existing Vector3 objects in the
faceNormals
array if they exist.inherited -
computeWorldFaceNormals(
Quaternion quat) → void -
Updates
worldVertices
and setsworldFaceNormalsNeedsUpdate
to false.inherited -
computeWorldVertices(
Vector3 position, Quaternion quat) → void -
Updates
.worldVertices
and sets.worldVerticesNeedsUpdate
to false.inherited -
findSeparatingAxis(
ConvexPolyhedron hullB, Vector3 posA, Quaternion quatA, Vector3 posB, Quaternion quatB, Vector3 target, [List< int> ? faceListA, List<int> ? faceListB]) → bool -
Find the separating axis between this hull and another
@param target The target vector to save the axis in
@return Returns false if a separation is found, else true
inherited
-
getAveragePointLocal(
[Vector3? target]) → Vector3 -
Get an average of all the vertices position
inherited
-
getFaceNormal(
int i, Vector3 target) → Vector3 -
Compute the normal of a face from its vertices
inherited
-
getPlaneConstantOfFace(
int faceI) → double -
@param face_i Index of the face
inherited
-
init(
[List< Vector3> ? vertices, List<List< ? faces, List<int> >Vector3?> ? normals, List<Vector3> ? axes, double? boundingSphereRadius]) → void -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pointIsInside(
Vector3 p) → bool -
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.
@param p A point given in local coordinates
inherited
-
testSepAxis(
Vector3 axis, ConvexPolyhedron hullB, Vector3 posA, Quaternion quatA, Vector3 posB, Quaternion quatB) → double? -
Test separating axis against two hulls. Both hulls are projected onto the axis and the overlap size is returned if there is one.
@return The overlap depth, or FALSE if no penetration.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
transformAllPoints(
[Vector3? offset, Quaternion? quat]) → void -
Transform all local points. Will change the .vertices
inherited
-
updateBoundingSphereRadius(
) → void -
Computes the bounding sphere radius.
The result is stored in the property
.boundingSphereRadius
inherited -
volume(
) → double -
Get approximate convex volume
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited