Here, I whipped this up in the SDK a few months ago to test out my theory
and it completely smoothed them out:
Add this to iviewrender:
virtual void        MP_PostSimulate() = 0;
and to viewrender:
virtual void    MP_PostSimulate();

then in cdll_client_int, inside OnRenderStart() after
simulateentities/physicssimulate and threadedbonesetup:
    //Tony; in multiplayer do some extra stuff. like re-calc the view if in
a vehicle!
    if ( engine->GetMaxClients() > 1 )
        view->MP_PostSimulate();

and finally the post simulate function itself.
I slapped it in view.cpp with the rest of the class:

void CViewRender::MP_PostSimulate()
{
    C_BasePlayer *pLocal = C_BasePlayer::GetLocalPlayer();
    if ( !pLocal )
        return;

    //Tony; if the local player is in a vehicle, then we need to kill the
bone cache, and re-calculate the view.
    if ( !pLocal->IsInAVehicle() && !pLocal->GetVehicle())
        return;

    IClientVehicle *pVehicle = pLocal->GetVehicle();
    Assert( pVehicle );
    CBaseAnimating *pVehicleEntity =
(CBaseAnimating*)pVehicle->GetVehicleEnt();
    Assert( pVehicleEntity );

    int nRole = pVehicle->GetPassengerRole( pLocal );

    //Tony; we have to invalidate the bone cache in order for the attachment
lookups to be correct!
    pVehicleEntity->InvalidateBoneCache();
    pVehicle->GetVehicleViewPosition( nRole, &m_View.origin, &m_View.angles,
&m_View.fov );

    //Tony; everything below is from SetupView - the things that should be
recalculated.. are recalculated!
    pLocal->CalcViewModelView( m_View.origin, m_View.angles );

    // Compute the world->main camera transform
    ComputeCameraVariables( m_View.origin, m_View.angles,
        &g_vecVForward, &g_vecVRight, &g_vecVUp, &g_matCamInverse );

    // set up the hearing origin...
    AudioState_t audioState;
    audioState.m_Origin = m_View.origin;
    audioState.m_Angles = m_View.angles;
    audioState.m_bIsUnderwater = pLocal && pLocal->AudioStateIsUnderwater(
m_View.origin );

    ToolFramework_SetupAudioState( audioState );

    m_View.origin = audioState.m_Origin;
    m_View.angles = audioState.m_Angles;

    engine->SetAudioState( audioState );

    g_vecPrevRenderOrigin = g_vecRenderOrigin;
    g_vecPrevRenderAngles = g_vecRenderAngles;
    g_vecRenderOrigin = m_View.origin;
    g_vecRenderAngles = m_View.angles;

#ifdef _DEBUG
    s_DbgSetupOrigin = m_View.origin;
    s_DbgSetupAngles = m_View.angles;
#endif


}


That should be sufficient. You're still going to have input lag as the
vehicles are server side, but depending on what you are trying to accomplish
it's actually not that bad.
-Tony


On Sun, Jan 24, 2010 at 9:21 PM, Chief Whosm <
[email protected]> wrote:

> Odd, got no warning to all those replies when I posted my last post - maybe
> gmail is slow today.
>
> So is the "*InvalidateBoneCache();"* the reason why Scratch SDK mp vehicles
> are fine, while hl2mp vehicles aren't since its all the same vehicle code
> for the most part? It's just Ive hunted the code and none of the sdk folder
> items have invalidatebonecache listed in their code.
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>


-- 
-Tony
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to