-
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
Allow Animator
to target other entities
#136
Conversation
This adds an optional property to `Animator` that stores an entity. If the property contains a value, it will be used as the target of the animation. Otherwise, the `Animator`'s entity will be used (default behavior).
This makes it so that the user can easily set/unset it later on.
Wrong kind of quote
I don't understand this rationale. Either you want to animate both translation and rotation at the same time, and then you use a combined Can you please provide some detailed example where that feature is useful? I'm all for adding new features, but this makes the code more complex, adds some indirection query, for a result which it seems can be achieved without any change. |
Yes, that particular example can be worked around by re-parenting, but my general rationale is that you sometimes want to target different fields of the same component via different animators. For example, let's say I want to create a button with a pulsing border width that loops indefinitely (as a way to attract player attention). I would need to insert an Maybe in a perfect world, components will always be split up in such a granular way that a problem like this will never happen. But in messy, complex scenarios, something like this will eventually be a problem. Especially when dealing with external libraries that you can't control. And when the time comes, you want your users to have the power to deal with it. As a precedent, But when it was upstreamed as observers, this problem was solved by decoupling the observer entity and the observed entity. So now an entity can have any number of observers of the same event type. Another limitation I've found is that you can't animate more than one component per animator. Which means that it's hard to make tween sequences that alternates between different components. Of course, something like this will require a massive rework, so it's pretty unlikely that it can be done in this library. As a comparison, tweening APIs from other game engines don't have any of the above limitations: see Godot, Unity, etc. For the reasons above I've since moved to |
This adds an optional property to
Animator
that stores an entity.If the property contains a value, it will be used as the target of the animation. Otherwise, the
Animator
's entity will be used (default behavior).This makes the creation of complex, modular tweens much easier. For example, you can now have one animator entity tweening
Transform::translation
and the other tweeningTransform::rotation
. Previously, this would have to be done with a single animator, which is very inflexible.They can be used like this: