-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Translation values still being changed after Animation played "Once" finished #33
Comments
The intended design is never to auto-remove components; it's too hard to guess how the user wants to use the component. The auto-remove can be implemented by the user. For the |
I tried to fix, this needs a Bevy change to be fixed cleanly. The change went in already (bevyengine/bevy#5438) so this can be fixed in next version when we upgrade to Bevy 0.8 (which is imminent). |
great, thanks for the reply :) and thanks for looking into this |
Ensure change detection on components and assets is only triggered when an animator effectively modifies said component or asset, and not invariably just by the simple fact of the animator ticking each frame. This change modifies the signature of the `component_animator_system()` and `asset_animator_system()` public functions to directly consume a `ResMut<Events<TweenCompleted>>` instead of an `EventWriter<TweenCompleted>`, to work around some internal limitations. It also publicly exposes a new `Targetable` trait used to work around the impossibility to retrieve a `Mut<T>` from a `Mut<Assets<T>>`. Instead, the trait provides an "target dereferencing" method `target_mut()` which dereferences the target component or asset, and triggers its change detection. The trait is implemented for all components via the `ComponentTarget` object, and for all assets via the `AssetTarget` object. The 3 types described here are publicly exposed to workaround some Bevy limitations, and because the trait appears in the public `Tweenable<T>` API. However users are discouraged from taking strong dependencies on those, as they will be removed once Bevy provides a way to achieve this conditionaly dereferencing without this workaround. TODO : CHANGELOG + CHANGE DETECTION TESTS Fixes #33
Ensure change detection on components and assets is only triggered when an animator effectively modifies said component or asset, and not invariably just by the simple fact of the animator ticking each frame. This change modifies the signature of the `component_animator_system()` and `asset_animator_system()` public functions to directly consume a `ResMut<Events<TweenCompleted>>` instead of an `EventWriter<TweenCompleted>`, to work around some internal limitations. It also publicly exposes a new `Targetable` trait used to work around the impossibility to retrieve a `Mut<T>` from a `Mut<Assets<T>>`. Instead, the trait provides an "target dereferencing" method `target_mut()` which dereferences the target component or asset, and triggers its change detection. The trait is implemented for all components via the `ComponentTarget` object, and for all assets via the `AssetTarget` object. The 3 types described here are publicly exposed to workaround some Bevy limitations, and because the trait appears in the public `Tweenable<T>` API. However users are discouraged from taking strong dependencies on those, as they will be removed once Bevy provides a way to achieve this conditionaly dereferencing without this workaround. Fixes #33
Ensure change detection on components and assets is only triggered when an animator effectively modifies said component or asset, and not invariably just by the simple fact of the animator ticking each frame. This change modifies the signature of the `component_animator_system()` and `asset_animator_system()` public functions to directly consume a `ResMut<Events<TweenCompleted>>` instead of an `EventWriter<TweenCompleted>`, to work around some internal limitations. It also publicly exposes a new `Targetable` trait used to work around the impossibility to retrieve a `Mut<T>` from a `Mut<Assets<T>>`. Instead, the trait provides an "target dereferencing" method `target_mut()` which dereferences the target component or asset, and triggers its change detection. The trait is implemented for all components via the `ComponentTarget` object, and for all assets via the `AssetTarget` object. The 3 types described here are publicly exposed to workaround some Bevy limitations, and because the trait appears in the public `Tweenable<T>` API. However users are discouraged from taking strong dependencies on those, as they will be removed once Bevy provides a way to achieve this conditionaly dereferencing without this workaround. Fixes #33
@jakyle sorry for the delay, that took a while. Bevy 0.8 did fix what I needed, but also introduced other blockers for this issue, so I had to get help from the ECS team to figure out how to fix and test this. Change detection should work as expected now, and I've added a test for components, but feel free to reopen if there's still an issue. |
Whenever I use the TransformPositionLens with TweeningType::Once, even after the animation is completed, the entitities transform seems to be "changed" still. I know this because I have another system listening on transform Change and it is triggering every frame.
the above system triggers the animation on map click, when the animation completes, the entities Transform still fires off
as a work around, I manually remove the AnimatorTransform on tween complete
However, I am not sure if this is the intended behavior. do we need to remove the Animator on animation complete. I expect that the intended behavior when using a TweeningType of Once is the component will be removed on animation complete for the entity and we use the TweenCompleted event for other stuff, like my use case here to remove my own component.
The text was updated successfully, but these errors were encountered: