Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed some engine traces failing #192

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions vphysics_jolt/vjolt_collide_trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ static float CalculateSourceFraction( const Vector &rayDelta, float fraction, co
//
// Casts a box against a shape
//
static void CastBoxVsShape( const Ray_t &ray, uint32 contentsMask, IConvexInfo *pConvexInfo, const CPhysCollide *pCollide, const Vector &collideOrigin, const QAngle &collideAngles, trace_t *pTrace )
static void CastBoxVsShape( const Ray_t &ray, uint32 contentsMask, IConvexInfo *pConvexInfo, const CPhysCollide *pCollide, const Vector &collideOrigin, const QAngle &collideAngles, trace_t *pTrace, bool mForceBackFace = false )
{
const JPH::Shape *pShape = pCollide->ToShape();

Expand All @@ -492,7 +492,7 @@ static void CastBoxVsShape( const Ray_t &ray, uint32 contentsMask, IConvexInfo *
//settings.mBackFaceModeTriangles = JPH::EBackFaceMode::CollideWithBackFaces;
// Josh: Had to re-enable CollideWithBackFaces to allow triggers for the Portal Environment to work.
// Come back here if we start getting stuck on things again...
if ( vjolt_trace_portal_hack.GetBool() )
if ( mForceBackFace || vjolt_trace_portal_hack.GetBool() )
settings.mBackFaceModeConvex = JPH::EBackFaceMode::CollideWithBackFaces;
//settings.mCollisionTolerance = kCollisionTolerance;
settings.mUseShrunkenShapeAndConvexRadius = true;
Expand Down Expand Up @@ -741,7 +741,8 @@ static void TraceBase( const Ray_t &ray, uint32 contentsMask, IConvexInfo *pConv
if ( isCollide )
{
// TODO(Slart): This should be CollideBoxVsShape, but I can't remember why it wasn't good enough...
CastBoxVsShape( ray, contentsMask, pConvexInfo, pCollide, collideOrigin, collideAngles, pTrace );
// RaphaelIT7: We need to use JPH::EBackFaceMode::CollideWithBackFaces because else the traces the engine uses to determent if you can unduck fail.
CastBoxVsShape( ray, contentsMask, pConvexInfo, pCollide, collideOrigin, collideAngles, pTrace, true );
}
else
{
Expand Down