Unity - procedurally change curvature of a quad?

Viewed 616

Alright, I currently have a flat quad and would like to add a script that procedurally increases/decreases the curvature of the quad. By curved quad I mean:

enter image description here

This would be a lower curvature value:

enter image description here

and this would be a higher curvature value:

enter image description here

I've found this script for procedurally determining the corner radius of a quad in Unity C#: https://answers.unity.com/questions/1007222/round-procedural-square-mesh-corners-c.html

however I dont have much experience w procedural mesh generation and don't know how to dive into this. How can I create a procedural curvature modifier in Unity/where can I start?

1 Answers

You should use rotation of vectors from the middle of the quad view from the side to the extreme edges. For example, V = rotate(some vector, Delta angle) V1 = rotate(V, Delta angle * 2) + shift to align the tail with V and so one.

If you want to know more about runtime mesh generation you can check out my game mathematics series: https://youtube.com/playlist?list=PLrtqd9jHm30NsA24NgkkcZHY8yjquBCVN

Related