Jolt Physics
A multi core friendly Game Physics Engine
|
A capsule with different top and bottom radii. More...
#include <TaperedCapsuleShape.h>
Classes | |
class | TaperedCapsule |
Static Public Member Functions | |
static void | sRegister () |
Static Public Member Functions inherited from ConvexShape | |
static void | sRegister () |
Static Public Member Functions inherited from Shape | |
static ShapeResult | sRestoreFromBinaryState (StreamIn &inStream) |
Creates a Shape of the correct type and restores its contents from the binary stream inStream. | |
static ShapeResult | sRestoreWithChildren (StreamIn &inStream, IDToShapeMap &ioShapeMap, IDToMaterialMap &ioMaterialMap) |
Restore a shape, all its children and materials. Pass in an empty map in ioShapeMap / ioMaterialMap or reuse the same map while reading multiple shapes from the same stream in order to restore duplicates. | |
Static Public Member Functions inherited from RefTarget< Shape > | |
static int | sInternalGetRefCountOffset () |
INTERNAL HELPER FUNCTION USED BY SERIALIZATION. | |
Protected Member Functions | |
virtual void | RestoreBinaryState (StreamIn &inStream) override |
This function should not be called directly, it is used by sRestoreFromBinaryState. | |
Additional Inherited Members | |
Public Types inherited from ConvexShape | |
enum class | ESupportMode { ExcludeConvexRadius , IncludeConvexRadius , Default } |
How the GetSupport function should behave. More... | |
Public Types inherited from Shape | |
using | ShapeResult = ShapeSettings::ShapeResult |
using | SupportingFace = StaticArray<Vec3, 32> |
Type definition for a supporting face. | |
using | VisitedShapes = UnorderedSet<const Shape *> |
using | ShapeToIDMap = StreamUtils::ObjectToIDMap<Shape> |
using | IDToShapeMap = StreamUtils::IDToObjectMap<Shape> |
using | MaterialToIDMap = StreamUtils::ObjectToIDMap<PhysicsMaterial> |
using | IDToMaterialMap = StreamUtils::IDToObjectMap<PhysicsMaterial> |
Static Public Attributes inherited from Shape | |
static constexpr int | cGetTrianglesMinTrianglesRequested = 32 |
This is the minimum amount of triangles that should be requested through GetTrianglesNext. | |
static bool | sDrawSubmergedVolumes = false |
Debug helper which draws the intersection between water and the shapes, the center of buoyancy and the submerged volume. | |
Static Protected Member Functions inherited from Shape | |
static void | sCollidePointUsingRayCast (const Shape &inShape, Vec3Arg inPoint, const SubShapeIDCreator &inSubShapeIDCreator, CollidePointCollector &ioCollector, const ShapeFilter &inShapeFilter) |
A fallback version of CollidePoint that uses a ray cast and counts the number of hits to determine if the point is inside the shape. Odd number of hits means inside, even number of hits means outside. | |
Protected Attributes inherited from RefTarget< Shape > | |
atomic< uint32 > | mRefCount |
Current reference count. | |
Static Protected Attributes inherited from ConvexShape | |
static const std::vector< Vec3 > | sUnitSphereTriangles |
Vertex list that forms a unit sphere. | |
Static Protected Attributes inherited from RefTarget< Shape > | |
static constexpr uint32 | cEmbedded |
A large value that gets added to the refcount to mark the object as embedded. | |
A capsule with different top and bottom radii.
|
inline |
Constructor.
TaperedCapsuleShape::TaperedCapsuleShape | ( | const TaperedCapsuleShapeSettings & | inSettings, |
ShapeResult & | outResult ) |
|
overridevirtual |
Collides all vertices of a soft body with this shape and updates SoftBodyVertex::mCollisionPlane, SoftBodyVertex::mCollidingShapeIndex and SoftBodyVertex::mLargestPenetration if a collision with more penetration was found.
inCenterOfMassTransform | Center of mass transform for this shape relative to the vertices. |
inScale | The scale to use for this shape |
ioVertices | The vertices of the soft body |
inNumVertices | The number of vertices in ioVertices |
inDeltaTime | Delta time of this time step (can be used to extrapolate the position using the velocity of the particle) |
inDisplacementDueToGravity | Displacement due to gravity during this time step |
inCollidingShapeIndex | Value to store in SoftBodyVertex::mCollidingShapeIndex when a collision was found |
Implements Shape.
|
overridevirtual |
Draw the shape at a particular location with a particular color (debugging purposes)
Implements Shape.
All shapes are centered around their center of mass. This function returns the center of mass position that needs to be applied to transform the shape to where it was created.
Reimplemented from Shape.
Returns the radius of the biggest sphere that fits entirely in the shape. In case this shape consists of multiple sub shapes, it returns the smallest sphere of the parts. This can be used as a measure of how far the shape can be moved without risking going through geometry.
Implements Shape.
|
overridevirtual |
Get local bounding box including convex radius, this box is centered around the center of mass rather than the world transform.
Implements Shape.
|
overridevirtual |
Calculate the mass and inertia of this shape.
Implements Shape.
Get stats of this shape. Use for logging / data collection purposes only. Does not add values from child shapes, use GetStatsRecursive for this.
Implements Shape.
|
overridevirtual |
Returns an object that provides the GetSupport function for this shape. inMode determines if this support function includes or excludes the convex radius. of the values returned by the GetSupport function. This improves numerical accuracy of the results. inScale scales this shape in local space.
Implements ConvexShape.
|
overridevirtual |
Get the vertices of the face that faces inDirection the most (includes any convex radius). Note that this function can only return faces of convex shapes or triangles, which is why a sub shape ID to get to that leaf must be provided.
inSubShapeID | Sub shape ID of target shape |
inDirection | Direction that the face should be facing (in local space to this shape) |
inCenterOfMassTransform | Transform to transform outVertices with |
inScale | Scale of this shape |
outVertices | Resulting face. The returned face can be empty if the shape doesn't have polygons to return (e.g. because it's a sphere). The face will be returned in world space. |
Reimplemented from Shape.
|
overridevirtual |
Get the surface normal of a particular sub shape ID and point on surface (all vectors are relative to center of mass for this shape). Note: When you have a CollideShapeResult or ShapeCastResult you should use -mPenetrationAxis.Normalized() as contact normal as GetSurfaceNormal will only return face normals (and not vertex or edge normals).
Implements Shape.
|
inline |
Get world space bounds including convex radius.
|
inlinevirtual |
Get world space bounds including convex radius. This shape is scaled by inScale in local space first. This function can be overridden to return a closer fitting world space bounding box, by default it will just transform what GetLocalBounds() returns.
Reimplemented from Shape.
|
overridevirtual |
Get world space bounds including convex radius. This shape is scaled by inScale in local space first. This function can be overridden to return a closer fitting world space bounding box, by default it will just transform what GetLocalBounds() returns.
Reimplemented from Shape.
Test if inScale is a valid scale for this shape. Some shapes can only be scaled uniformly, compound shapes cannot handle shapes being rotated and scaled (this would cause shearing), scale can never be zero. When the scale is invalid, the function will return false.
Here's a list of supported scales:
Reimplemented from Shape.
This function should not be called directly, it is used by sRestoreFromBinaryState.
Reimplemented from ConvexShape.
Saves the contents of the shape in binary form to inStream.
Reimplemented from ConvexShape.
|
static |
|
overridevirtual |
Transforms this shape and all of its children with inTransform, resulting shape(s) are passed to ioCollector. Note that not all shapes support all transforms (especially true for scaling), the resulting shape will try to match the transform as accurately as possible.
inCenterOfMassTransform | The transform (rotation, translation, scale) that the center of mass of the shape should get |
ioCollector | The transformed shapes will be passed to this collector |
Reimplemented from Shape.