|
@@ -83,6 +83,7 @@ void SoftBodyShape::CastRay(const RayCast &inRay, const RayCastSettings &inRayCa
|
|
|
return;
|
|
|
|
|
|
uint num_triangle_bits = GetSubShapeIDBits();
|
|
|
+ bool check_backfaces = inRayCastSettings.mBackFaceModeTriangles == EBackFaceMode::IgnoreBackFaces && !mSoftBodyMotionProperties->GetFacesDoubleSided();
|
|
|
|
|
|
const Array<SoftBodyVertex> &vertices = mSoftBodyMotionProperties->GetVertices();
|
|
|
for (const SoftBodyMotionProperties::Face &f : mSoftBodyMotionProperties->GetFaces())
|
|
@@ -92,7 +93,7 @@ void SoftBodyShape::CastRay(const RayCast &inRay, const RayCastSettings &inRayCa
|
|
|
Vec3 x3 = vertices[f.mVertex[2]].mPosition;
|
|
|
|
|
|
// Back facing check
|
|
|
- if (inRayCastSettings.mBackFaceModeTriangles == EBackFaceMode::IgnoreBackFaces && (x2 - x1).Cross(x3 - x1).Dot(inRay.mDirection) > 0.0f)
|
|
|
+ if (check_backfaces && (x2 - x1).Cross(x3 - x1).Dot(inRay.mDirection) > 0.0f)
|
|
|
continue;
|
|
|
|
|
|
// Test ray against triangle
|
|
@@ -245,7 +246,10 @@ void SoftBodyShape::sCollideConvexVsSoftBody(const Shape *inShape1, const Shape
|
|
|
const Array<SoftBodyMotionProperties::Face> &faces = shape2->mSoftBodyMotionProperties->GetFaces();
|
|
|
uint num_triangle_bits = shape2->GetSubShapeIDBits();
|
|
|
|
|
|
- CollideConvexVsTriangles collider(shape1, inScale1, inScale2, inCenterOfMassTransform1, inCenterOfMassTransform2, inSubShapeIDCreator1.GetID(), inCollideShapeSettings, ioCollector);
|
|
|
+ CollideShapeSettings settings(inCollideShapeSettings);
|
|
|
+ if (shape2->mSoftBodyMotionProperties->GetFacesDoubleSided())
|
|
|
+ settings.mBackFaceMode = EBackFaceMode::CollideWithBackFaces;
|
|
|
+ CollideConvexVsTriangles collider(shape1, inScale1, inScale2, inCenterOfMassTransform1, inCenterOfMassTransform2, inSubShapeIDCreator1.GetID(), settings, ioCollector);
|
|
|
for (const SoftBodyMotionProperties::Face &f : faces)
|
|
|
{
|
|
|
Vec3 x1 = vertices[f.mVertex[0]].mPosition;
|
|
@@ -267,7 +271,10 @@ void SoftBodyShape::sCollideSphereVsSoftBody(const Shape *inShape1, const Shape
|
|
|
const Array<SoftBodyMotionProperties::Face> &faces = shape2->mSoftBodyMotionProperties->GetFaces();
|
|
|
uint num_triangle_bits = shape2->GetSubShapeIDBits();
|
|
|
|
|
|
- CollideSphereVsTriangles collider(shape1, inScale1, inScale2, inCenterOfMassTransform1, inCenterOfMassTransform2, inSubShapeIDCreator1.GetID(), inCollideShapeSettings, ioCollector);
|
|
|
+ CollideShapeSettings settings(inCollideShapeSettings);
|
|
|
+ if (shape2->mSoftBodyMotionProperties->GetFacesDoubleSided())
|
|
|
+ settings.mBackFaceMode = EBackFaceMode::CollideWithBackFaces;
|
|
|
+ CollideSphereVsTriangles collider(shape1, inScale1, inScale2, inCenterOfMassTransform1, inCenterOfMassTransform2, inSubShapeIDCreator1.GetID(), settings, ioCollector);
|
|
|
for (const SoftBodyMotionProperties::Face &f : faces)
|
|
|
{
|
|
|
Vec3 x1 = vertices[f.mVertex[0]].mPosition;
|
|
@@ -287,7 +294,10 @@ void SoftBodyShape::sCastConvexVsSoftBody(const ShapeCast &inShapeCast, const Sh
|
|
|
const Array<SoftBodyMotionProperties::Face> &faces = shape->mSoftBodyMotionProperties->GetFaces();
|
|
|
uint num_triangle_bits = shape->GetSubShapeIDBits();
|
|
|
|
|
|
- CastConvexVsTriangles caster(inShapeCast, inShapeCastSettings, inScale, inCenterOfMassTransform2, inSubShapeIDCreator1, ioCollector);
|
|
|
+ ShapeCastSettings settings(inShapeCastSettings);
|
|
|
+ if (shape->mSoftBodyMotionProperties->GetFacesDoubleSided())
|
|
|
+ settings.mBackFaceModeTriangles = EBackFaceMode::CollideWithBackFaces;
|
|
|
+ CastConvexVsTriangles caster(inShapeCast, settings, inScale, inCenterOfMassTransform2, inSubShapeIDCreator1, ioCollector);
|
|
|
for (const SoftBodyMotionProperties::Face &f : faces)
|
|
|
{
|
|
|
Vec3 x1 = vertices[f.mVertex[0]].mPosition;
|
|
@@ -307,7 +317,10 @@ void SoftBodyShape::sCastSphereVsSoftBody(const ShapeCast &inShapeCast, const Sh
|
|
|
const Array<SoftBodyMotionProperties::Face> &faces = shape->mSoftBodyMotionProperties->GetFaces();
|
|
|
uint num_triangle_bits = shape->GetSubShapeIDBits();
|
|
|
|
|
|
- CastSphereVsTriangles caster(inShapeCast, inShapeCastSettings, inScale, inCenterOfMassTransform2, inSubShapeIDCreator1, ioCollector);
|
|
|
+ ShapeCastSettings settings(inShapeCastSettings);
|
|
|
+ if (shape->mSoftBodyMotionProperties->GetFacesDoubleSided())
|
|
|
+ settings.mBackFaceModeTriangles = EBackFaceMode::CollideWithBackFaces;
|
|
|
+ CastSphereVsTriangles caster(inShapeCast, settings, inScale, inCenterOfMassTransform2, inSubShapeIDCreator1, ioCollector);
|
|
|
for (const SoftBodyMotionProperties::Face &f : faces)
|
|
|
{
|
|
|
Vec3 x1 = vertices[f.mVertex[0]].mPosition;
|