- Home /
Flying monsters in a 2d environment using bezier curves
I'm trying to work out how to create flying monsters in a 2d environment that swoop down in bezier curves. They can move freely, meaning they won't collide with anything. Are there any good tutorials or explanations of how this is done?
There are lots of potential answers to this question, and your ideal solution will depend on many different factors that you have not listed.
Are you looking for a single swoop from a fixed position or are the flying monsters co$$anonymous$$g from various positions.
Do you want the same swoop for each time, or do you want variations?
Does the camera/character move or is the scene fixed?
Do you want the swoop to aim at the character or is it a fixed swoop that might catch the character?
Potential solutions:
Code the curves using function. For example 1-x^.35 over the range of 0 to 1 swoops. Or I think x = Tan(y) might work.
You could use an AnimationCurve and create any kind of curve you want.
For more control, you can create a set of waypoints to form a curve.
iTween has path following code and also provides a path editor.
You could code it using Rigidbodies and forces, creating stronger lift at points closer to the ground and building velocity through constant force. Or by redirecting the angle of velocity based on the distance from the ground.
I would highly recommend iTween for this kind of thing... this is what it was built for.
I've decided to go with itween on this after having read through the docs. Thanks for the suggestions guys :)