DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ GetApproximateMovementOffset()

override vector Weapon_Base::GetApproximateMovementOffset ( vector localVelocity,
int characterStance,
float lean,
float ud11,
float lr11 )
inlineprotected

См. определение в файле Pistol_Base.c строка 704

705 {
706 if (characterStance >= DayZPlayerConstants.STANCEIDX_RAISED)
707 characterStance -= DayZPlayerConstants.STANCEIDX_RAISED;
708
709 vector offset;
710 if (lean != 0)
711 {
712 const float LEAN_VERT_OFFSET = -0.1;
713 const float LEAN_HORIZ_OFFSET_L = 0.075;
714 const float LEAN_HORIZ_OFFSET_R = -0.025;
715 float aimStraightWeight = 1.0 - Math.AbsFloat(ud11); // 1 when aiming forward
716 float leanOffset = lean * aimStraightWeight;
717 offset += Vector( leanOffset * Math.Lerp(LEAN_HORIZ_OFFSET_L, LEAN_HORIZ_OFFSET_R, lean * 0.5 + 0.5), leanOffset * LEAN_VERT_OFFSET, 0);
718 }
719 float maxVelocity = Math.Max( Math.AbsFloat(localVelocity[0]), Math.AbsFloat(localVelocity[2]) );
720 float peakVelocity = 0.5;
721 float moveAmount01 = Math.Clamp(maxVelocity / peakVelocity, 0.0, 1.0);
722 if (moveAmount01 != 0.0)
723 {
724 vector moveOffset;
725 if (characterStance == DayZPlayerConstants.STANCEIDX_CROUCH)
726 moveOffset = "-0.1 -0.2 -0.1";
727 else
728 moveOffset = "0.0 -0.12 -0.1";
729
730
731 float ud01 = (ud11 * 0.5) + 0.5;
732 float aimWeight = Math.Clamp(1.0 - (ud01 * 2), 0, 1);
733 // The issue is only apparent when looking down and the 2nd power seems
734 // to follow the actual visual relatively accurately
735 float moveWeight = moveAmount01 * Math.Pow(aimWeight, 2.0);
736 offset = offset + (moveWeight * moveOffset);
737 }
738
739 return offset;
740 }
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
proto native vector Vector(float x, float y, float z)
Vector constructor from components.

Перекрестные ссылки Math::AbsFloat(), Math::Clamp(), Math::Lerp(), Math::Max(), Math::Pow() и Vector().

Используется в Weapon::ApproximateWeaponLiftTransform().