Guest User

Untitled

a guest
Apr 16th, 2018
62
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private function moveTransition(event:TimerEvent) {
  2.  
  3. var easing:Number = 0.2;
  4. var dist:Vector3 = new Vector3();
  5. var vel:Vector3 = new Vector3();
  6. var snapScope:int = 1;
  7.  
  8. dist = targetPos.subtract(pos);
  9.  
  10. vel.x = dist.x * easing;
  11. vel.y = dist.y * easing;
  12. vel.z = dist.z * easing;
  13.  
  14. pos = pos.add(vel);
  15.  
  16. var posx = Math.floor(pos.x);
  17. var posy = Math.floor(pos.y);
  18. var posz = Math.floor(pos.z);
  19. var tposx = Math.floor(targetPos.x);
  20. var tposy = Math.floor(targetPos.y);
  21. var tposz = Math.floor(targetPos.z);
  22.  
  23. if ((posx == tposx || posx == (tposx - snapScope) || posx == (tposx + snapScope)) &&
  24. (posx == tposy || posy == (tposy - snapScope) || posy == (tposy + snapScope)) &&
  25. (posx == tposz || posz == (tposz - snapScope) || posz == (tposz + snapScope))) {
  26.  
  27. trace ("nodeID:" + nodeID + " - *** stop timer");
  28. transTimer.stop();
  29. positionStable = true;
  30. //app.resumeNavMode();
  31. } else {
  32. trace ("--------------------------");
  33. trace ("nodeID:" + nodeID + " - " + posx + " : " + tposx);
  34. trace ("nodeID:" + nodeID + " - " + posy + " : " + tposy);
  35. trace ("nodeID:" + nodeID + " - " + posz + " : " + tposz);
  36. }
  37. }
RAW Paste Data