fix wrong collision box scaling of physics props

This commit is contained in:
wjxggg 2025-01-09 23:04:30 +08:00
parent 29985681a1
commit 326e3665a6

View File

@ -6071,18 +6071,18 @@ bool UTIL_CreateScaledPhysObject( CBaseAnimating *pInstance, float flScale )
pInstance->VPhysicsDestroyObject(); pInstance->VPhysicsDestroyObject();
pInstance->VPhysicsSetObject( pNewObject ); pInstance->VPhysicsSetObject( pNewObject );
// Scale the base model as well
pInstance->SetModelScale( flScale );
// Increase our model bounds // Increase our model bounds
const model_t *pModel = modelinfo->GetModel( pInstance->GetModelIndex() ); const model_t *pModel = modelinfo->GetModel( pInstance->GetModelIndex() );
if ( pModel ) if ( pModel )
{ {
Vector mins, maxs; Vector mins, maxs;
modelinfo->GetModelBounds( pModel, 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() ) if ( pInstance->GetParent() )
{ {
pNewObject->SetShadow( 1e4, 1e4, false, false ); pNewObject->SetShadow( 1e4, 1e4, false, false );