Path: blob/master/thirdparty/jolt_physics/Jolt/Physics/Collision/CastConvexVsTriangles.h
9912 views
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)1// SPDX-FileCopyrightText: 2021 Jorrit Rouwe2// SPDX-License-Identifier: MIT34#pragma once56#include <Jolt/Physics/Collision/Shape/ConvexShape.h>7#include <Jolt/Physics/Collision/ShapeCast.h>89JPH_NAMESPACE_BEGIN1011/// Collision detection helper that casts a convex object vs one or more triangles12class JPH_EXPORT CastConvexVsTriangles13{14public:15/// Constructor16/// @param inShapeCast The shape to cast against the triangles and its start and direction17/// @param inShapeCastSettings Settings for performing the cast18/// @param inScale Local space scale for the shape to cast against (scales relative to its center of mass).19/// @param inCenterOfMassTransform2 Is the center of mass transform of shape 2 (excluding scale), this is used to provide a transform to the shape cast result so that local quantities can be transformed into world space.20/// @param inSubShapeIDCreator1 Class that tracks the current sub shape ID for the casting shape21/// @param ioCollector The collector that receives the results.22CastConvexVsTriangles(const ShapeCast &inShapeCast, const ShapeCastSettings &inShapeCastSettings, Vec3Arg inScale, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, CastShapeCollector &ioCollector);2324/// Cast convex object with a single triangle25/// @param inV0 , inV1 , inV2: CCW triangle vertices26/// @param inActiveEdges bit 0 = edge v0..v1 is active, bit 1 = edge v1..v2 is active, bit 2 = edge v2..v0 is active27/// An active edge is an edge that is not connected to another triangle in such a way that it is impossible to collide with the edge28/// @param inSubShapeID2 The sub shape ID for the triangle29void Cast(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2, uint8 inActiveEdges, const SubShapeID &inSubShapeID2);3031protected:32const ShapeCast & mShapeCast;33const ShapeCastSettings & mShapeCastSettings;34const Mat44 & mCenterOfMassTransform2;35Vec3 mScale;36SubShapeIDCreator mSubShapeIDCreator1;37CastShapeCollector & mCollector;3839private:40ConvexShape::SupportBuffer mSupportBuffer; ///< Buffer that holds the support function of the cast shape41const ConvexShape::Support * mSupport = nullptr; ///< Support function of the cast shape42float mScaleSign; ///< Sign of the scale, -1 if object is inside out, 1 if not43};4445JPH_NAMESPACE_END464748