File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Sources/GateEngine/Resources/Import & Export/Importers Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -786,7 +786,8 @@ extension GLTransmissionFormat: SkeletalAnimationImporter {
786786 addChildren ( gltfNode: rootNode, parentJoint: rootJoint)
787787 }
788788
789- var timeMax : Float = - 1_000_000_000
789+ var timeMax : Float = . nan
790+ var timeMin : Float = . nan
790791
791792 for channel in animation. channels {
792793 let jointAnimation = jointAnimation ( forTarget: channel. target. node)
@@ -849,10 +850,20 @@ extension GLTransmissionFormat: SkeletalAnimationImporter {
849850 break
850851 }
851852
852- timeMax = . maximum( times. max ( ) !, timeMax)
853+ if let max = times. max ( ) {
854+ timeMax = . maximum( max, timeMax)
855+ }
856+ if let min = times. min ( ) {
857+ timeMin = . minimum( min, timeMin)
858+ }
859+ }
860+
861+ var duration = timeMax - timeMin
862+ if duration. isFinite == false {
863+ duration = 0
853864 }
854865
855- return SkeletalAnimationBackend ( name: animation. name, duration: timeMax , animations: animations)
866+ return SkeletalAnimationBackend ( name: animation. name, duration: duration , animations: animations)
856867 }
857868}
858869
You can’t perform that action at this time.
0 commit comments