Преглед на файлове

Adding computeVelocity getter method to Object

clementlandrin преди 5 месеца
родител
ревизия
49e3a2618e
променени са 1 файла, в които са добавени 6 реда и са изтрити 2 реда
  1. 6 2
      h3d/scene/Object.hx

+ 6 - 2
h3d/scene/Object.hx

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