Advertisement
Guest User

Untitled

a guest
May 3rd, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1.  
  2. import java.util.Timer;
  3. import java.util.TimerTask;
  4.  
  5. /**
  6. *
  7. * @author Marcel
  8. */
  9. public class PhysicsSimulator {
  10.  
  11. private World world;
  12. private ARDroneActor drone;
  13. private Timer timer = new Timer();
  14. double[] position = drone.getPosition();
  15.  
  16. public PhysicsSimulator() {
  17. TimerTask task;
  18. world.getActors();
  19. task = new TimerTask() {
  20. @Override
  21. public void run() {
  22.  
  23. if (position[2] > 0) {
  24.  
  25. position[2] -= 0.1;
  26. drone.setPosition(position);
  27.  
  28. }
  29. }
  30. };
  31. timer.scheduleAtFixedRate(task, 0, 100);
  32.  
  33. }
  34.  
  35. public void setWorld(World world) {
  36. this.world = world;
  37.  
  38. }
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement