Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. var rotation = game.getGameplayCamRot(0);
  2. var position = flying.position;
  3. var direction = one_utils.rotationToDirection(rotation);
  4.  
  5. var xMagnitude = game.getDisabledControlNormal(0, 1);
  6. var yMagnitude = game.getDisabledControlNormal(0, 2);
  7.  
  8. var speed = 1;
  9. if(!one_utils.getKeysDisabled()) {
  10. if(one_utils.getKeyState(16) == "down") {
  11. speed = 3;
  12. } else if(one_utils.getKeyState(18) == "down") {
  13. speed = 0.5;
  14. }
  15.  
  16. if(one_utils.getKeyState(0x53) == "down") {
  17. position.x = position.x - (direction.x * speed);
  18. position.y = position.y - (direction.y * speed);
  19. position.z = position.z - (direction.z * speed);
  20. }
  21.  
  22. if(one_utils.getKeyState(0x57) == "down") {
  23. position.x = position.x + (direction.x * speed);
  24. position.y = position.y + (direction.y * speed);
  25. position.z = position.z + (direction.z * speed);
  26. }
  27.  
  28. if(one_utils.getKeyState(0x41) == "down") {
  29. position.x = position.x + (-direction.y * speed);
  30. position.y = position.y + (direction.x * speed);
  31. }
  32.  
  33. if(one_utils.getKeyState(0x44) == "down") {
  34. position.x = position.x - (-direction.y * speed);
  35. position.y = position.y - (direction.x * speed);
  36. }
  37.  
  38. if(xMagnitude !== 0) {
  39. rotation.z = rotation.z + (-xMagnitude) * (speed * 10);
  40. }
  41. }
  42.  
  43. flying.position = position;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement