jumpAssinger.sqf 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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=2;//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. _namVertJumpDistY=20;//in meters
  20. _namVertJumpDistX=5;//in meters
  21. _namVertJumpVeloY=1;//meters/second
  22. _namVertJumpVeloX=1;//meters/second
  23. //Short calculations
  24. _namShortJumpVeloY=sqrt(-2*-9.8*_namShortJumpDistY);
  25. _tShort=(-_namShortJumpDistY)/(-9.8);
  26. _namShortJumpVeloX=_namShortJumpDistX/(2*_tShort);
  27. //Long calculations
  28. _namLongJumpVeloY=sqrt(-2*-9.8*_namLongJumpDistY);
  29. _tLong=(-_namLongJumpDistY)/(-9.8);
  30. _namLongJumpVeloX=_namLongJumpDistX/(2*_tLong);
  31. //Vert calculations
  32. _namVertJumpVeloY=sqrt(-2*-9.8*_namVertJumpDistY);
  33. _tVert=(-_namVertJumpDistY)/(-9.8);
  34. _namVertJumpVeloX=_namVertJumpDistX/(2*_tVert);
  35. jumpPhysicsData=[[_namShortJumpVeloX,_namShortJumpVeloY],[_namLongJumpVeloX,_namLongJumpVeloY],[_namVertJumpVeloX,_namVertJumpVeloY]];
  36. personToApply setVariable ["jumpPhysicsArray", jumpPhysicsData,true];