Przeglądaj źródła

Adding computeVelocity getter method to Object

clementlandrin 5 miesięcy temu
rodzic
commit
49e3a2618e
1 zmienionych plików z 6 dodań i 2 usunięć
  1. 6 2
      h3d/scene/Object.hx

+ 6 - 2
h3d/scene/Object.hx

@@ -691,8 +691,12 @@ class Object {
 		return follow = v;
 		return follow = v;
 	}
 	}
 
 
+	function computeVelocity() {
+		return prevAbsPosFrame != NO_VELOCITY;
+	}
+
 	function calcPrevAbsPos() {
 	function calcPrevAbsPos() {
-		if ( prevAbsPosFrame == NO_VELOCITY )
+		if ( !computeVelocity() )
 			prevAbsPos = null;
 			prevAbsPos = null;
 		else if ( prevAbsPosFrame < hxd.Timer.frameCount ) {
 		else if ( prevAbsPosFrame < hxd.Timer.frameCount ) {
 			prevAbsPosFrame = hxd.Timer.frameCount;
 			prevAbsPosFrame = hxd.Timer.frameCount;
@@ -845,7 +849,7 @@ class Object {
 		var prevForcedScreenRatio : Float = ctx.forcedScreenRatio;
 		var prevForcedScreenRatio : Float = ctx.forcedScreenRatio;
 		if ( !drawn || !ctx.computeVelocity || fixedPosition || culled  )
 		if ( !drawn || !ctx.computeVelocity || fixedPosition || culled  )
 			prevAbsPosFrame = NO_VELOCITY;
 			prevAbsPosFrame = NO_VELOCITY;
-		else if ( prevAbsPosFrame == NO_VELOCITY )
+		else if ( !computeVelocity() )
 				prevAbsPosFrame = VELOCITY;
 				prevAbsPosFrame = VELOCITY;
 		calcPrevAbsPos();
 		calcPrevAbsPos();