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

Fix wrong collision box scaling of physics props #410

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion game/client/c_baseanimating.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4981,9 +4981,10 @@ bool C_BaseAnimating::TestHitboxes( const Ray_t &ray, unsigned int fContentsMask
VPhysicsSetObject( pReplace );
}
}
return true;
}

return true;
return false;
}


Expand Down
3 changes: 2 additions & 1 deletion game/server/baseanimating.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2693,8 +2693,9 @@ bool CBaseAnimating::TestHitboxes( const Ray_t &ray, unsigned int fContentsMask,
tr.surface.name = "**studio**";
tr.surface.flags = SURF_HITBOX;
tr.surface.surfaceProps = physprops->GetSurfaceIndex( pBone->pszSurfaceProp() );
return true;
}
return true;
return false;
}

void CBaseAnimating::InitBoneControllers ( void ) // FIXME: rename
Expand Down
8 changes: 4 additions & 4 deletions game/server/props.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6071,18 +6071,18 @@ bool UTIL_CreateScaledPhysObject( CBaseAnimating *pInstance, float flScale )
pInstance->VPhysicsDestroyObject();
pInstance->VPhysicsSetObject( pNewObject );

// Scale the base model as well
pInstance->SetModelScale( flScale );

// Increase our model bounds
const model_t *pModel = modelinfo->GetModel( pInstance->GetModelIndex() );
if ( pModel )
{
Vector mins, maxs;
modelinfo->GetModelBounds( pModel, mins, maxs );
pInstance->SetCollisionBounds( mins*flScale, maxs*flScale );
pInstance->SetCollisionBounds( mins, maxs );
}

// Scale the base model as well
pInstance->SetModelScale( flScale );

if ( pInstance->GetParent() )
{
pNewObject->SetShadow( 1e4, 1e4, false, false );
Expand Down