Prevents NaN time when animation length is 0 (case of a pose)
This commit is contained in:
		
							parent
							
								
									247d5d9324
								
							
						
					
					
						commit
						435f2d4d05
					
				| @ -31,10 +31,6 @@ | |||||||
|  */ |  */ | ||||||
| package com.jme3.animation; | package com.jme3.animation; | ||||||
| 
 | 
 | ||||||
| import static com.jme3.animation.LoopMode.Cycle; |  | ||||||
| import static com.jme3.animation.LoopMode.DontLoop; |  | ||||||
| import static com.jme3.animation.LoopMode.Loop; |  | ||||||
| 
 |  | ||||||
| /** | /** | ||||||
|  * |  * | ||||||
|  * @author Nehon |  * @author Nehon | ||||||
| @ -52,7 +48,7 @@ public class AnimationUtils { | |||||||
|      * @return  |      * @return  | ||||||
|      */ |      */ | ||||||
|      public static float clampWrapTime(float time, float duration, LoopMode loopMode){ |      public static float clampWrapTime(float time, float duration, LoopMode loopMode){ | ||||||
|         if (time == 0) { |          if (time == 0 || duration == 0) { | ||||||
|             return 0; // prevent division by 0 errors |             return 0; // prevent division by 0 errors | ||||||
|         }         |         }         | ||||||
|         switch (loopMode) { |         switch (loopMode) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user