mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-01-13 07:17:57 +03:00
Added weight blending for IK attachment rules
This commit is contained in:
parent
c3176b34d0
commit
6d48f52d12
@ -2797,14 +2797,29 @@ void C_BaseAnimating::CalculateIKLocks( float currentTime )
|
|||||||
|
|
||||||
// debugoverlay->AddBoxOverlay( origin, Vector( -1, -1, -1 ), Vector( 1, 1, 1 ), QAngle( 0, 0, 0 ), 255, 0, 0, 0, 0 );
|
// debugoverlay->AddBoxOverlay( origin, Vector( -1, -1, -1 ), Vector( 1, 1, 1 ), QAngle( 0, 0, 0 ), 255, 0, 0, 0, 0 );
|
||||||
|
|
||||||
float d = (pTarget->est.pos - origin).Length();
|
Vector vecDelta = (origin - pTarget->est.pos);
|
||||||
|
float d = vecDelta.Length();
|
||||||
|
|
||||||
if ( d >= flDist)
|
if ( d >= flDist)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
flDist = d;
|
flDist = d;
|
||||||
pTarget->SetPos( origin );
|
#ifdef MAPBASE
|
||||||
pTarget->SetAngles( angles );
|
// For blending purposes, IK attachments should obey weight
|
||||||
|
if ( pTarget->est.flWeight < 1.0f )
|
||||||
|
{
|
||||||
|
Quaternion qTarget;
|
||||||
|
AngleQuaternion( angles, qTarget );
|
||||||
|
|
||||||
|
QuaternionSlerp( pTarget->est.q, qTarget, pTarget->est.flWeight, pTarget->est.q );
|
||||||
|
pTarget->SetPos( pTarget->est.pos + (vecDelta * pTarget->est.flWeight) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
pTarget->SetPos( origin );
|
||||||
|
pTarget->SetAngles( angles );
|
||||||
|
}
|
||||||
// debugoverlay->AddBoxOverlay( pTarget->est.pos, Vector( -pTarget->est.radius, -pTarget->est.radius, -pTarget->est.radius ), Vector( pTarget->est.radius, pTarget->est.radius, pTarget->est.radius), QAngle( 0, 0, 0 ), 0, 255, 0, 0, 0 );
|
// debugoverlay->AddBoxOverlay( pTarget->est.pos, Vector( -pTarget->est.radius, -pTarget->est.radius, -pTarget->est.radius ), Vector( pTarget->est.radius, pTarget->est.radius, pTarget->est.radius), QAngle( 0, 0, 0 ), 0, 255, 0, 0, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user