void HumanSkeletonRotations::Apply(const SkeletonModifierContext& ctx, refSkeleton_t* skeleton) { // HACK: Stop taunt from clipping through the body. int anim = CG_AnimNumber( ctx.es->torsoAnim ); if ( anim >= TORSO_GESTURE_BLASTER && anim <= TORSO_GESTURE_CKIT ) { quat_t rot; QuatFromAngles( rot, 15, 0, 0 ); QuatMultiply2( skeleton->bones[ 33 ].t.rot, rot ); } // rotate torso if ( torsoControlBone >= 0 && torsoControlBone < skeleton->numBones ) { // HACK: convert angles to bone system quat_t rotation; QuatFromAngles( rotation, ctx.torsoYawAngle, 0, 0 ); QuatMultiply2( skeleton->bones[ torsoControlBone ].t.rot, rotation ); } // HACK: limit angle (avoids worst of the gun clipping through the body) // Needs some proper animation fixes... auto pitch = Math::Clamp<vec_t>(ctx.pitchAngle, -60, 60); quat_t rotation; QuatFromAngles( rotation, -pitch, 0, 0 ); QuatMultiply2( skeleton->bones[ rightShoulderBone ].t.rot, rotation ); // Relationships are emphirically derived. They will probably need to be changed upon changes to the human model QuatFromAngles( rotation, pitch, pitch < 0 ? -pitch / 9 : -pitch / ( 8 - ( 5 * ( pitch / 90 ) ) ), 0 ); QuatMultiply2( skeleton->bones[ leftShoulderBone ].t.rot, rotation ); }
void AnimDelta::Apply(const entityState_t* es, refSkeleton_t* skeleton) { if ( ( es->torsoAnim & ~ANIM_TOGGLEBIT ) < TORSO_ATTACK ) return; auto it = deltas_.find( es->weapon ); if ( it == deltas_.end() ) return; for ( size_t i = 0; i < it->second.size(); ++i ) { VectorAdd( it->second[ i ].delta, skeleton->bones[ boneIndicies_[ i ] ].t.trans, skeleton->bones[ boneIndicies_[ i ] ].t.trans ); QuatMultiply2( skeleton->bones[ boneIndicies_[ i ] ].t.rot, it->second[ i ].rot ); } }
void BsuitSkeletonRotations::Apply(const SkeletonModifierContext& ctx, refSkeleton_t* skeleton) { // rotate torso if ( torsoControlBone >= 0 && torsoControlBone < skeleton->numBones ) { // HACK: convert angles to bone system quat_t rotation; QuatFromAngles( rotation, ctx.torsoYawAngle, 0, 0 ); QuatMultiply2( skeleton->bones[ torsoControlBone ].t.rot, rotation ); } // HACK: limit angle (avoids worst of the gun clipping through the body) // Needs some proper animation fixes... auto pitch = Math::Clamp<vec_t>(ctx.pitchAngle, -40, 20); quat_t rotation; QuatFromAngles( rotation, -pitch, 0, 0 ); QuatMultiply2( skeleton->bones[ rightShoulderBone ].t.rot, rotation ); // Relationships are emphirically derived. They will probably need to be changed upon changes to the human model QuatFromAngles( rotation, pitch, 0, 0); QuatMultiply2( skeleton->bones[ leftShoulderBone ].t.rot, rotation ); }