- Home /
Create Dynamic Flapping Flag (that can resize)
Greetings fellow Unity tinkerers,
I have a rather interesting problem I was hoping to gain some insight into a possible solution to.
I would like to create a flag that flaps in the wind...but also resizes!
See I plan to have the flag represnt a units health, and as it takes damage the width of the flag decreases.
Is there a way to have the flag both animate (flapping) but resize its width (and add damage tears) to it?
If it were static of course I could just use an animation call, but since its resizing as it takes damage Im puzzled about the best way to approach this.
My skill level is intermediate with C# & Unity so I'll probably understand almost anything you can suggest :)
Answer by Fattie · Sep 02, 2012 at 08:20 AM
it's very easy to resize it, just use localScale
no problem with localScale'ing a playing complex animation
regarding "doing damage" that's always difficult. basically it's quite simply .. a different object.
in this situation, just have yer art department make say 20 different versions of the flag, in various humorous states of degradation. that's about all you can do!
(You could get in to like repainting the texture on the fly with tatters etc, but it seems absurd here to suggest that.)
As a rule "progressive damage" is very simply you build and swap out a series of models. Hope it helps!
PS I'm sure you're aware there are many "flapping flag!" animations sitting around, many free
Gotcha, so I could have say 5 flag states. Each of them can be the same length, but just add more damage to successive models. So model 1 is used at 100%, model 2 used between 80-99.9%, another 60-79.99%, etc. And the models could feature more and more freyed edges and $$anonymous$$rs. And I could use the same localscale.x (I was concerned about warping though). But I figure this is the best overall bet. Only 1 way to find out! Thanks
sounds great!
you could even forget about the scale, and just make the 5 or 10 models, different sizes. then it's all done in one. (if that fits your scheme.) Cheers!
Your answer
![](https://koobas.hobune.stream/wayback/20220613080520im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Effects of Graphics.Blit to rendertexture are temporary 2 Answers
Shader and normal map working when editing, but sprite turns black when running with animations 2 Answers
poor performance is slowing down the rate 1 Answer
Help with GUI, Textures and Materials (Health Circle) 1 Answer
How to create Timer animations? 1 Answer