X-Git-Url: http://www2.svjatoslav.eu/gitweb/?p=sixth-3d.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fsixth%2Fe3d%2Fgui%2FAvatar.java;h=7f0f698f41946e72964ba003d6d1eab6a31f9967;hp=6e4c5ec6daa039e5fc1a7d8f423ea4747dc95367;hb=baab2e2c2ad89695293f3136311c585c9a5afed1;hpb=2e7e46514dd35006e9dde07b1959540078292691 diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/Avatar.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/Avatar.java index 6e4c5ec..7f0f698 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/Avatar.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/Avatar.java @@ -14,7 +14,7 @@ import eu.svjatoslav.sixth.e3d.geometry.Point3D; import static java.lang.Math.cos; import static java.lang.Math.sin; -public class Avatar implements ViewUpdateListener { +public class Avatar implements ViewRenderListener { public static final double SPEED_LIMIT = 30; /** @@ -70,7 +70,7 @@ public class Avatar implements ViewUpdateListener { } @Override - public boolean beforeViewUpdate(final ViewContext viewContext, final int millisecondsSinceLastFrame) { + public boolean beforeRender(final ViewContext viewContext, final int millisecondsSinceLastFrame) { final Point3D locationBeforeUpdate = new Point3D(location); translateAvatarLocation(millisecondsSinceLastFrame); @@ -84,8 +84,7 @@ public class Avatar implements ViewUpdateListener { } public void enforceSpeedLimit() { - final double currentSpeed = movementVector - .getDistanceTo(Point3D.ZERO); + final double currentSpeed = movementVector.getVectorLength(); if (currentSpeed <= SPEED_LIMIT) return; @@ -122,7 +121,7 @@ public class Avatar implements ViewUpdateListener { } public double getMovementSpeed() { - return movementVector.getDistanceTo(Point3D.ZERO); + return movementVector.getVectorLength(); } private void applyFrictionToUserMovement(int millisecondsPassedSinceLastFrame) {