Browse Source

prevent event repeat with fast non looping animation

ncannasse 9 years ago
parent
commit
6c13880f56
1 changed files with 1 additions and 0 deletions
  1. 1 0
      h3d/anim/Animation.hx

+ 1 - 0
h3d/anim/Animation.hx

@@ -182,6 +182,7 @@ class Animation {
 		if( events != null && onEvent != null ) {
 			var f0 = Std.int(frame);
 			var f1 = Std.int(frame + dt * speed * sampling);
+			if( f1 >= frameCount ) f1 = frameCount - 1;
 			for( f in f0...f1 + 1 ) {
 				if( f == lastEvent ) continue;
 				lastEvent = f;