Jolt Physics
A multi core friendly Game Physics Engine
|
#include <StaticCompoundShape.h>
Static Public Member Functions | |
static void | sRegister () |
Static Public Member Functions inherited from CompoundShape | |
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. | |
Protected Member Functions inherited from CompoundShape | |
uint | GetSubShapeIDBits () const |
Determine amount of bits needed to encode sub shape id. | |
void | CalculateInnerRadius () |
Determine the inner radius of this shape. | |
Additional Inherited Members | |
Public Types inherited from CompoundShape | |
using | SubShapes = Array<SubShape> |
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 CompoundShape | |
Vec3 | mCenterOfMass { Vec3::sZero() } |
Center of mass of the compound. | |
AABox | mLocalBounds |
SubShapes | mSubShapes |
float | mInnerRadius = FLT_MAX |
Smallest radius of GetInnerRadius() of child shapes. | |
Protected Attributes inherited from RefTarget< Shape > | |
atomic< uint32 > | mRefCount |
Current reference count. | |
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 compound shape, sub shapes can be rotated and translated. Sub shapes cannot be modified once the shape is constructed. Shifts all child objects so that they're centered around the center of mass.
|
inline |
Constructor.
StaticCompoundShape::StaticCompoundShape | ( | const StaticCompoundShapeSettings & | inSettings, |
TempAllocator & | inTempAllocator, | ||
ShapeResult & | outResult ) |
|
overridevirtual |
Cast a ray against this shape. Allows returning multiple hits through ioCollector. Note that this version is more flexible but also slightly slower than the CastRay function that returns only a single hit. If you want the surface normal of the hit use GetSurfaceNormal(collected sub shape ID, inRay.GetPointOnRay(collected faction)).
Implements Shape.
|
overridevirtual |
Cast a ray against this shape, returns true if it finds a hit closer than ioHit.mFraction and updates that fraction. Otherwise ioHit is left untouched and the function returns false. Note that the ray should be relative to the center of mass of this shape (i.e. subtract Shape::GetCenterOfMass() from RayCast::mOrigin if you want to cast against the shape in the space it was created). Convex objects will be treated as solid (meaning if the ray starts inside, you'll get a hit fraction of 0) and back face hits against triangles are returned. If you want the surface normal of the hit use GetSurfaceNormal(ioHit.mSubShapeID2, inRay.GetPointOnRay(ioHit.mFraction)).
Implements Shape.
|
overridevirtual |
Collect the leaf transformed shapes of all leaf shapes of this shape. inBox is the world space axis aligned box which leaf shapes should collide with. inPositionCOM/inRotation/inScale describes the transform of this shape. inSubShapeIDCeator represents the current sub shape ID of this shape.
Reimplemented from Shape.
|
overridevirtual |
Check if inPoint is inside this shape. For this tests all shapes are treated as if they were solid. Note that inPoint should be relative to the center of mass of this shape (i.e. subtract Shape::GetCenterOfMass() from inPoint if you want to test against the shape in the space it was created). For a mesh shape, this test will only provide sensible information if the mesh is a closed manifold. For each shape that collides, ioCollector will receive a hit.
Implements Shape.
|
overridevirtual |
Get which sub shape's bounding boxes overlap with an axis aligned box
inBox | The axis aligned box to test against (relative to the center of mass of this shape) |
outSubShapeIndices | Buffer where to place the indices of the sub shapes that intersect |
inMaxSubShapeIndices | How many indices will fit in the buffer (normally you'd provide a buffer of GetNumSubShapes() indices) |
Implements CompoundShape.
|
overridevirtual |
Get which sub shape's bounding boxes overlap with an axis aligned box
inBox | The axis aligned box to test against (relative to the center of mass of this shape) |
outSubShapeIndices | Buffer where to place the indices of the sub shapes that intersect |
inMaxSubShapeIndices | How many indices will fit in the buffer (normally you'd provide a buffer of GetNumSubShapes() indices) |
Implements CompoundShape.
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.
This function should not be called directly, it is used by sRestoreFromBinaryState.
Reimplemented from CompoundShape.
Saves the contents of the shape in binary form to inStream.
Reimplemented from CompoundShape.
|
static |