|
@@ -11,6 +11,7 @@
|
|
|
#include <Physics/Collision/Shape/ScaledShape.h>
|
|
|
#include <Physics/Collision/Shape/BoxShape.h>
|
|
|
#include <Physics/Collision/ShapeFilter.h>
|
|
|
+#include <Physics/Collision/CollisionDispatch.h>
|
|
|
#include "PhysicsTestContext.h"
|
|
|
#include "Layers.h"
|
|
|
|
|
@@ -30,7 +31,7 @@ TEST_SUITE("CastShapeTests")
|
|
|
cast_settings.mBackFaceModeConvex = EBackFaceMode::IgnoreBackFaces;
|
|
|
cast_settings.mReturnDeepestPoint = false;
|
|
|
AllHitCollisionCollector<CastShapeCollector> collector;
|
|
|
- inTriangle->CastShape(shape_cast, cast_settings, Vec3::sReplicate(1.0f), ShapeFilter(), Mat44::sIdentity(), SubShapeIDCreator(), SubShapeIDCreator(), collector);
|
|
|
+ CollisionDispatch::sCastShapeVsShape(shape_cast, cast_settings, inTriangle, Vec3::sReplicate(1.0f), ShapeFilter(), Mat44::sIdentity(), SubShapeIDCreator(), SubShapeIDCreator(), collector);
|
|
|
CHECK(collector.mHits.size() == 1);
|
|
|
const ShapeCastResult &result = collector.mHits.back();
|
|
|
CHECK_APPROX_EQUAL(result.mFraction, (15.0f - 0.2f) / 30.0f, 1.0e-4f);
|
|
@@ -49,13 +50,13 @@ TEST_SUITE("CastShapeTests")
|
|
|
cast_settings.mBackFaceModeConvex = EBackFaceMode::IgnoreBackFaces;
|
|
|
cast_settings.mReturnDeepestPoint = false;
|
|
|
AllHitCollisionCollector<CastShapeCollector> collector;
|
|
|
- inTriangle->CastShape(shape_cast, cast_settings, Vec3::sReplicate(1.0f), ShapeFilter(), Mat44::sIdentity(), SubShapeIDCreator(), SubShapeIDCreator(), collector);
|
|
|
+ CollisionDispatch::sCastShapeVsShape(shape_cast, cast_settings, inTriangle, Vec3::sReplicate(1.0f), ShapeFilter(), Mat44::sIdentity(), SubShapeIDCreator(), SubShapeIDCreator(), collector);
|
|
|
CHECK(collector.mHits.empty());
|
|
|
|
|
|
// Hit back face -> collision
|
|
|
cast_settings.mBackFaceModeTriangles = EBackFaceMode::CollideWithBackFaces;
|
|
|
cast_settings.mBackFaceModeConvex = EBackFaceMode::CollideWithBackFaces;
|
|
|
- inTriangle->CastShape(shape_cast, cast_settings, Vec3::sReplicate(1.0f), ShapeFilter(), Mat44::sIdentity(), SubShapeIDCreator(), SubShapeIDCreator(), collector);
|
|
|
+ CollisionDispatch::sCastShapeVsShape(shape_cast, cast_settings, inTriangle, Vec3::sReplicate(1.0f), ShapeFilter(), Mat44::sIdentity(), SubShapeIDCreator(), SubShapeIDCreator(), collector);
|
|
|
CHECK(collector.mHits.size() == 1);
|
|
|
const ShapeCastResult &result = collector.mHits.back();
|
|
|
CHECK_APPROX_EQUAL(result.mFraction, (15.0f - 0.2f) / 30.0f, 1.0e-4f);
|
|
@@ -74,13 +75,13 @@ TEST_SUITE("CastShapeTests")
|
|
|
cast_settings.mBackFaceModeConvex = EBackFaceMode::IgnoreBackFaces;
|
|
|
cast_settings.mReturnDeepestPoint = true;
|
|
|
AllHitCollisionCollector<CastShapeCollector> collector;
|
|
|
- inTriangle->CastShape(shape_cast, cast_settings, Vec3::sReplicate(1.0f), ShapeFilter(), Mat44::sIdentity(), SubShapeIDCreator(), SubShapeIDCreator(), collector);
|
|
|
+ CollisionDispatch::sCastShapeVsShape(shape_cast, cast_settings, inTriangle, Vec3::sReplicate(1.0f), ShapeFilter(), Mat44::sIdentity(), SubShapeIDCreator(), SubShapeIDCreator(), collector);
|
|
|
CHECK(collector.mHits.empty());
|
|
|
|
|
|
// Hit back face while starting in collision -> collision
|
|
|
cast_settings.mBackFaceModeTriangles = EBackFaceMode::CollideWithBackFaces;
|
|
|
cast_settings.mBackFaceModeConvex = EBackFaceMode::CollideWithBackFaces;
|
|
|
- inTriangle->CastShape(shape_cast, cast_settings, Vec3::sReplicate(1.0f), ShapeFilter(), Mat44::sIdentity(), SubShapeIDCreator(), SubShapeIDCreator(), collector);
|
|
|
+ CollisionDispatch::sCastShapeVsShape(shape_cast, cast_settings, inTriangle, Vec3::sReplicate(1.0f), ShapeFilter(), Mat44::sIdentity(), SubShapeIDCreator(), SubShapeIDCreator(), collector);
|
|
|
CHECK(collector.mHits.size() == 1);
|
|
|
const ShapeCastResult &result = collector.mHits.back();
|
|
|
CHECK_APPROX_EQUAL(result.mFraction, 0.0f);
|