jumpAssinger.sqf 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //params["personToApply"];
  2. personToApply=_this select 0;
  3. personToApply removeAllEventHandlers "HandleDamage";
  4. comment "is Jumping-0
  5. last jump time-1
  6. jump counter-2
  7. cooldown-3
  8. max consecutive jumps-4";
  9. jumpData=[false,0,0,5,2];
  10. personToApply setVariable ["jumpArray", jumpData,true];
  11. _namShortJumpDistY=5;//in meters
  12. _namShortJumpDistX=10;//in meters
  13. _namShortJumpVeloY=1;//meters/second
  14. _namShortJumpVeloX=1;//meters/second
  15. _namLongJumpDistY=20;//in meters
  16. _namLongJumpDistX=45;//in meters
  17. _namLongJumpVeloY=1;//meters/second
  18. _namLongJumpVeloX=1;//meters/second
  19. //Short calculations
  20. _namShortJumpVeloY=sqrt(-2*-9.8*_namShortJumpDistY);
  21. _tShort=(-_namShortJumpDistY)/(-9.8);
  22. _namShortJumpVeloX=_namShortJumpDistX/(2*_tShort);
  23. //Long calculations
  24. _namLongJumpVeloY=sqrt(-2*-9.8*_namLongJumpDistY);
  25. _tLong=(-_namLongJumpDistY)/(-9.8);
  26. _namLongJumpVeloX=_namLongJumpDistX/(2*_tLong);
  27. jumpPhysicsData=[[_namShortJumpVeloX,_namShortJumpVeloY],[_namLongJumpVeloX,_namLongJumpVeloY]];
  28. personToApply setVariable ["jumpPhysicsArray", jumpPhysicsData,true];