Yo folks,
Is it possible to grab an IPhysicsObject for a bone on the client from a
server-side ragdoll? Or does the physics object simply not exist on the
client?
I have a nice function here that sorta takes care of it, but I'm under the
impression you can't retrieve it simply because it's a server-side ragdoll,
so the physics aren't initialized on the client as well.
The code seems unnecessarily long, I could probably at least remove the
else after physicsbone >= 0, but here it is. physicsbone is obtained from a
trace.
IPhysicsObject *GetPhysObjFromPhysicsBone( CBaseEntity *pEntity, short
physicsbone )
{
CBaseAnimating *pModel = static_cast< CBaseAnimating * >( pEntity );
if ( pModel == NULL )
{
return pEntity->VPhysicsGetObject();
}
else
{
IPhysicsObject *pPhysicsObject = NULL;
//Find the real object we hit.
if( physicsbone >= 0 )
{
#ifdef CLIENT_DLL
if ( pModel->m_pRagdoll )
{
CRagdoll *pCRagdoll = dynamic_cast < CRagdoll * > ( pModel->m_pRagdoll );
#else
// Affect the object
CRagdollProp *pCRagdoll = dynamic_cast<CRagdollProp*>( pEntity );
#endif
if ( pCRagdoll )
{
ragdoll_t *pRagdollT = pCRagdoll->GetRagdoll();
if ( physicsbone < pRagdollT->listCount )
{
pPhysicsObject = pRagdollT->list[physicsbone].pObject;
}
return pPhysicsObject;
}
else
{
return pEntity->VPhysicsGetObject();
}
#ifdef CLIENT_DLL
}
else
{
return pEntity->VPhysicsGetObject();
}
#endif
}
else
{
return pEntity->VPhysicsGetObject();
}
}
}
Holla,
Andrew
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders