diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2011-03-08 01:46:26 +0000 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2011-03-08 01:46:26 +0000 |
commit | 6cd8a65423b94f8f074ee3db4500e98ee8633017 (patch) | |
tree | 8d52358fd23f774297a821212a01d426e35930cd | |
parent | 6399678d37243d0ee770dda231b1be6b71f22ec5 (diff) |
Attempt 2
-rw-r--r-- | src/tesseract/objects/PhysicalObject.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/tesseract/objects/PhysicalObject.java b/src/tesseract/objects/PhysicalObject.java index 96c9bfa..43990f4 100644 --- a/src/tesseract/objects/PhysicalObject.java +++ b/src/tesseract/objects/PhysicalObject.java @@ -134,10 +134,12 @@ public class PhysicalObject extends CollidableObject { * Move the object to the correct side of the new world. */ public void rotateForTransmission(PeerInformation a, PeerInformation b) { - double angle = /*Math.atan(-velocity.z / velocity.x) + */ Math.PI + Math.atan((b.location.getY() - a.location.getY()) / (b.location.getX() - a.location.getX())); + Vector3f velnormal = new Vector3f(velocity); + velnormal.normalize(); + velnormal.negate(); - position.x = (float) (position.x * Math.cos(angle) - position.z * Math.sin(angle)); - position.z = (float) (position.z * Math.cos(angle) + position.x * Math.sin(angle)); + position.x = velnormal.x * position.x; + position.z = velnormal.z * -position.z; } /** |