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

◆ GetApproximateMovementOffset()

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

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

1528 {
1529 vector offset;
1530 if (lean != 0)
1531 {
1532 const float LEAN_VERT_OFFSET = -0.1;
1533 const float LEAN_HORIZ_OFFSET_L = 0;
1534 const float LEAN_HORIZ_OFFSET_R = 0.01;
1535 float aimStraightWeight = 1.0 - Math.AbsFloat(ud11); // 1 when aiming forward
1536 float leanOffset = lean * aimStraightWeight;
1537 offset += Vector( leanOffset * Math.Lerp(LEAN_HORIZ_OFFSET_L, LEAN_HORIZ_OFFSET_R, lean * 0.5 + 0.5), leanOffset * LEAN_VERT_OFFSET, 0);
1538 }
1539
1540
1541 float maxVelocity = Math.Max( Math.AbsFloat(localVelocity[0]), Math.AbsFloat(localVelocity[2]) );
1542 float peakVelocity = 0.5;
1543 float moveAmount01 = Math.Clamp(maxVelocity / peakVelocity, 0.0, 1.0);
1544 if (moveAmount01 != 0.0)
1545 {
1546 vector moveOffset = "0 -0.2 -0.1";
1547 float ud01 = (ud11 * 0.5) + 0.5;
1548 float aimWeight = Math.Clamp(1.0 - (ud01 * 2), 0, 1);
1549 // The issue is only apparent when looking down and the 2nd power seems
1550 // to follow the actual visual relatively accurately
1551 float moveWeight = moveAmount01 * Math.Pow(aimWeight, 2.0);
1552 offset = offset + (moveWeight * moveOffset);
1553 }
1554
1555 return offset;
1556 }
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().