685 {
688
689 vector offset;
690 if (lean != 0)
691 {
692 const float LEAN_VERT_OFFSET = -0.1;
693 const float LEAN_HORIZ_OFFSET_L = 0.075;
694 const float LEAN_HORIZ_OFFSET_R = -0.025;
695 float aimStraightWeight = 1.0 - Math.AbsFloat(ud11);
696 float leanOffset = lean * aimStraightWeight;
697 offset +=
Vector( leanOffset * Math.Lerp(LEAN_HORIZ_OFFSET_L, LEAN_HORIZ_OFFSET_R, lean * 0.5 + 0.5), leanOffset * LEAN_VERT_OFFSET, 0);
698 }
699 float maxVelocity = Math.Max( Math.AbsFloat(localVelocity[0]), Math.AbsFloat(localVelocity[2]) );
700 float peakVelocity = 0.5;
701 float moveAmount01 = Math.Clamp(maxVelocity / peakVelocity, 0.0, 1.0);
702 if (moveAmount01 != 0.0)
703 {
704 vector moveOffset;
706 moveOffset = "-0.1 -0.2 -0.1";
707 else
708 moveOffset = "0.0 -0.12 -0.1";
709
710
711 float ud01 = (ud11 * 0.5) + 0.5;
712 float aimWeight = Math.Clamp(1.0 - (ud01 * 2), 0, 1);
713
714
715 float moveWeight = moveAmount01 * Math.Pow(aimWeight, 2.0);
716 offset = offset + (moveWeight * moveOffset);
717 }
718
719 return offset;
720 }
DayZPlayerConstants
defined in C++
proto native vector Vector(float x, float y, float z)
Vector constructor from components.