Small bug fixes

[#] Fixed some engine traces failing.
 (some traces the engine uses to determent if you can unduck failed)
[#] Fixed CheckCollision checking collisions even if collisions are disabled(IsCollisionEnabled = false)
[#] JoltPhysicsObject::GetName() now returns a proper name instead of "NoName"
In Gmod If you used tostring(Entity(1):GetPhysicsObject()) it returned NoName instead of player_stand or player_crouch.
This commit is contained in:
RaphaelIT7 2023-10-01 06:25:00 +02:00
parent 50cef39716
commit cc791dd311
4 changed files with 9 additions and 5 deletions

View File

@ -38,7 +38,8 @@ static ConVar vjolt_trace_debug_collidebox( "vjolt_trace_debug_collidebox", "0",
// Slart and I have not been able to determine the root cause of this problem and have tried for a long time...
//
// Slart: Portal 2 probably passes in a bad winding order in the polyhedron or something, dunno if it affects Portal 1
static ConVar vjolt_trace_portal_hack( "vjolt_trace_portal_hack", "0", FCVAR_NONE );
// RaphaelIT7: We this needs to always be enabled because else the traces the engine uses to determent if you can unduck fail.
// static ConVar vjolt_trace_portal_hack( "vjolt_trace_portal_hack", "0", FCVAR_NONE );
//-------------------------------------------------------------------------------------------------
//
@ -492,8 +493,8 @@ 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() )
settings.mBackFaceModeConvex = JPH::EBackFaceMode::CollideWithBackFaces;
// if ( vjolt_trace_portal_hack.GetBool() )
settings.mBackFaceModeConvex = JPH::EBackFaceMode::CollideWithBackFaces;
//settings.mCollisionTolerance = kCollisionTolerance;
settings.mUseShrunkenShapeAndConvexRadius = true;
settings.mReturnDeepestPoint = true;

View File

@ -157,6 +157,8 @@ bool JoltPhysicsPlayerController::WasFrozen()
static void CheckCollision( JoltPhysicsObject *pObject, JPH::CollideShapeCollector &ioCollector, JPH::BodyFilter &ioFilter )
{
if (!pObject->IsCollisionEnabled()) { return; } // If we have no collisions, we have nothing to check.
JPH::PhysicsSystem *pSystem = pObject->GetEnvironment()->GetPhysicsSystem();
// TODO(Josh): Make a PLAYER ONLY layer that will only collide with MOVING ONLY annd

View File

@ -31,6 +31,7 @@ JoltPhysicsObject::JoltPhysicsObject( JPH::Body *pBody, JoltPhysicsEnvironment *
, m_pGameData( pParams->pGameData )
, m_materialIndex( Max( nMaterialIndex, 0 ) ) // Sometimes we get passed -1.
, m_flVolume( pParams->volume )
, m_pName( pParams->pName )
{
// Josh:
// Assert that m_pGameData is the first element, some games
@ -916,8 +917,7 @@ const CPhysCollide *JoltPhysicsObject::GetCollide() const
const char *JoltPhysicsObject::GetName() const
{
// Slart: Jolt used to store debug names in JPH::Body, but it was removed. So now everybody's NoName.
return "NoName";
return m_pName;
}
//-------------------------------------------------------------------------------------------------

View File

@ -239,6 +239,7 @@ private:
// remain un-named offset by the vtable to get to this
// instead of calling GetGameData().
void *m_pGameData = nullptr;
const char *m_pName = "NoName";
uint16 m_gameFlags = 0;
uint16 m_gameIndex = 0;