Cylinder class

Cylinder class. @example const radiusTop = 0.5 const radiusBottom = 0.5 const height = 2 const numSegments = 12 const cylinderShape = new CANNON.Cylinder(radiusTop, radiusBottom, height, numSegments) const cylinderBody = new CANNON.Body({ mass: 1, shape: cylinderShape }) world.addBody(cylinderBody)

Inheritance

Constructors

Cylinder({double radiusTop = 1, double radiusBottom = 1, double height = 1, int numSegments = 8})
@param radiusTop The radius of the top of the Cylinder. @param radiusBottom The radius of the bottom of the Cylinder. @param height The height of the Cylinder. @param numSegments The number of segments to build the cylinder out of.

Properties

aabbmax Vec3
finalinherited
aabbmin Vec3
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<Vec3?>
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 Cylinder.
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 cylinder out of.
getter/setter pair
radiusBottom double
The radius of the bottom of the Cylinder.
getter/setter pair
radiusTop double
The radius of the top of the Cylinder.
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<Vec3>?
If given, these locally defined, normalized axes are the only ones being checked when doing separating axis check.
getter/setter pairinherited
uniqueEdges List<Vec3>
getter/setter pairinherited
vertices List<Vec3>
getter/setter pairinherited
worldFaceNormals List<Vec3>
getter/setter pairinherited
worldFaceNormalsNeedsUpdate bool
getter/setter pairinherited
worldVertices List<Vec3>
getter/setter pairinherited
worldVerticesNeedsUpdate bool
getter/setter pairinherited

Methods

calculateLocalInertia(double 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
inherited
calculateWorldAABB(Vec3 pos, Quaternion quat, Vec3 min, Vec3 max) → void
@todo use abstract for these kind of methods
inherited
clipAgainstHull(Vec3 posA, Quaternion quatA, ConvexPolyhedron hullB, Vec3 posB, Quaternion quatB, Vec3 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(Vec3 separatingNormal, Vec3 posA, Quaternion quatA, List<Vec3> worldVertsB1, double minDist, double maxDist, List<ConvexPolyhedronContactPoint> result) → void
Clip a face against a hull. @param worldVertsB1 An array of Vec3 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<Vec3> inVertices, List<Vec3> outVertices, Vec3 planeNormal, double planeConstant) List<Vec3>
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(Vec3 aabbmin, Vec3 aabbmax) → void
inherited
computeNormals() → void
Compute the normals of the faces. Will reuse existing Vec3 objects in the faceNormals array if they exist.
inherited
computeWorldFaceNormals(Quaternion quat) → void
Updates worldVertices and sets worldFaceNormalsNeedsUpdate to false.
inherited
computeWorldVertices(Vec3 position, Quaternion quat) → void
Updates .worldVertices and sets .worldVerticesNeedsUpdate to false.
inherited
findSeparatingAxis(ConvexPolyhedron hullB, Vec3 posA, Quaternion quatA, Vec3 posB, Quaternion quatB, Vec3 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([Vec3? target]) Vec3
Get an average of all the vertices position
inherited
getFaceNormal(int i, Vec3 target) Vec3
Compute the normal of a face from its vertices
inherited
getPlaneConstantOfFace(int faceI) double
@param face_i Index of the face
inherited
init(List<Vec3>? vertices, List<List<int>>? faces, List<Vec3?>? normals, List<Vec3>? axes, double? boundingSphereRadius) → void
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pointIsInside(Vec3 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(Vec3 axis, ConvexPolyhedron hullB, Vec3 posA, Quaternion quatA, Vec3 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([Vec3? 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