How to make flowers swing in light breeze?

Hello my fellow game developers and game developers to-be.

First off, let me apologize for posting this here. I don’t know where else to post it so I did it here since this is also the stage of where Iam in the course.

Iam working on a simple 2D kids game (based on BrickBreaker). The core of the game is finished and working (no wonder, just look at our instructors), now I want to visualy
spice things up a little bit. For that matter I want to add to my main game scene a few small flowers that are swinging in light summer breeze.

First I thought that I could manage this with bone based animation (I have finished GlitchGarden so far where I learnt on the subject) but I think its a lot of work for a not so satisfying result in my case, its generic and not really convincing.

Now Iam looking for an alternative aproach to this problem using physics.
So far, based on my googling powers, my plan on sloving this would look
something like this:

-add rigidbody2D to my flowers
-use hinge joints for attaching / anchoring flowers to the ground (or wherever) and use a sprint on it
-figure out a way to make wind or something similar using one of many options
avalible. I was thinkig about utilising gravity and making it change
non-stop or something in this manner.

Now I have a few question for those with more expertise:

  1. Does this sound like a possible approach to the problem?
  2. Is there a better way to solving this? How?
  3. If I suppose I got the first two bulletpoints right, what would be the best way for making thigs swing randomly?

Thanks to anyone ready to give me some advice on this or point me into right direction. Obviously Iam a begginer without a 3D game yet. But I want to finish this and the Blender course before moving on with Unity and BowlMaster.

And I apologise again for posting this here, I didn’t know where else to put this thing on this whole forum.

Rok

I got this working the way I explained:

-Added rigidbody2D, added hinge joint 2D and set gravity to 15

Everything looks much better already. The only thing is that with time, flowers stop swinging. So Iam still looking for an alternative solution, some random forces pressing here and there on the flowers so they keep on swinging.

Also the gravity seem so be affecting slightly the ball that is flying around and smashing into stuff. Not much, but still. Is that possible even or is it just my imagination?

1 Like

For an input source of noise, use Mathf.PerlinNoise (Or Perlin, I forget which) which will give you a good random natural looking source of noise. From there you could just tweak it in the update setting or something like that.

I wouldn’t tweak gravity for that, but maybe that’s just me…

Privacy & Terms