idanarye / bevy-yoleck

Your Own Level Editor Creation Kit
Other
172 stars 11 forks source link

Add a visual marker for the selected entity #9

Open idanarye opened 2 years ago

idanarye commented 2 years ago

Would also be nice to mark hovered entities, to make it easier to tell what will be selected.

idanarye commented 2 years ago

Since all kind of things can be selected, I don't want to use sprite/mesh/material manipulation. I can think of 3 things that would be universal(ish):

  1. Visibility - blink the selected entity.
  2. Transform - do a pulse and/or shake animation.
  3. Marker entity with graphics, that'll point at the selected entity.

Option 1 would be the easiest, but would probably look terrible. Option 3 would be hard to pull off, because I'll need to determine the size of the object on the screen. Also, it'll be harder

The option I like the most is option 2. I think, instead of using an animation plugin, I'll plant my own animation in CoreStage::PostUpdate after TransformSystem::TransformPropagate. There I'll change the GlobalTransform (not the Transofrm!) of the selected entity and its children.

Or even better - change the Transform before TransformPropagate but remember its value, and restore that value after it. That way GlobalTransform will just work normally.