# HG changeset patch # User Sam # Date 1687195858 -25200 # Node ID eb5ae1f1bc8782d1a9484b2086dcc0cd87de105b # Parent bcd246da025dfc9ce42b61f24a01115d51598e79 fix: do not apply last frame value after animation has stopped diff -r bcd246da025d -r eb5ae1f1bc87 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 bcd246da025d -r eb5ae1f1bc87 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 bcd246da025d -r eb5ae1f1bc87 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