1534 {
1535 vector offset;
1536 if (lean != 0)
1537 {
1538 const float LEAN_VERT_OFFSET = -0.1;
1539 const float LEAN_HORIZ_OFFSET_L = 0;
1540 const float LEAN_HORIZ_OFFSET_R = 0.01;
1541 float aimStraightWeight = 1.0 - Math.AbsFloat(ud11);
1542 float leanOffset = lean * aimStraightWeight;
1543 offset +=
Vector( leanOffset * Math.Lerp(LEAN_HORIZ_OFFSET_L, LEAN_HORIZ_OFFSET_R, lean * 0.5 + 0.5), leanOffset * LEAN_VERT_OFFSET, 0);
1544 }
1545
1546
1547 float maxVelocity = Math.Max( Math.AbsFloat(localVelocity[0]), Math.AbsFloat(localVelocity[2]) );
1548 float peakVelocity = 0.5;
1549 float moveAmount01 = Math.Clamp(maxVelocity / peakVelocity, 0.0, 1.0);
1550 if (moveAmount01 != 0.0)
1551 {
1552 vector moveOffset = "0 -0.2 -0.1";
1553 float ud01 = (ud11 * 0.5) + 0.5;
1554 float aimWeight = Math.Clamp(1.0 - (ud01 * 2), 0, 1);
1555
1556
1557 float moveWeight = moveAmount01 * Math.Pow(aimWeight, 2.0);
1558 offset = offset + (moveWeight * moveOffset);
1559 }
1560
1561 return offset;
1562 }
proto native vector Vector(float x, float y, float z)
Vector constructor from components.