# HG changeset patch # User Sam # Date 1687195858 -25200 # Node ID d4b4ad20357881d7a7216c1422ad4a6f5659c927 # Parent e3aa2680394dfa031fe87b458f1021e6a0281731 fix: do not apply last frame value after animation has stopped diff -r e3aa2680394d -r d4b4ad203578 src/semicongine/animation.nim --- a/src/semicongine/animation.nim Mon Jun 19 01:14:58 2023 +0700 +++ b/src/semicongine/animation.nim Tue Jun 20 00:30:58 2023 +0700 @@ -36,7 +36,7 @@ AnimationPlayer*[T] = object animation*: Animation[T] currentTime: float32 - playing: bool + playing*: bool currentDirection: int currentIteration: int currentValue*: T diff -r e3aa2680394d -r d4b4ad203578 src/semicongine/core/matrix.nim --- a/src/semicongine/core/matrix.nim Mon Jun 19 01:14:58 2023 +0700 +++ b/src/semicongine/core/matrix.nim Tue Jun 20 00:30:58 2023 +0700 @@ -117,7 +117,7 @@ maxwidth = 0 for n in value.data: - let strval = $n + let strval = &"{n:.2}" strvalues.add(strval) if strval.len > maxwidth: maxwidth = strval.len diff -r e3aa2680394d -r d4b4ad203578 src/semicongine/scene.nim --- a/src/semicongine/scene.nim Mon Jun 19 01:14:58 2023 +0700 +++ b/src/semicongine/scene.nim Tue Jun 20 00:30:58 2023 +0700 @@ -51,14 +51,11 @@ func update*(animation: var EntityAnimation, dt: float32) = animation.player.advance(dt) -func getValue*(animation: var EntityAnimation): Mat4 = - return animation.player.currentValue - func transform*(entity: Entity): Mat4 = result = entity.internal_transform for component in entity.components.mitems: - if component of EntityAnimation: - result = result * EntityAnimation(component).getValue + if component of EntityAnimation and EntityAnimation(component).player.playing: + result = result * EntityAnimation(component).player.currentValue func originalTransform*(entity: Entity): Mat4 = entity.internal_transform