As a continuation of yesterday’s learning project, today is yet another great tutorial from catlikecoding.com, and an extension of yesterday’s generated graph functions in 3D space.

Now, I’ll be the first to say that this kind of math is *not* exactly in my wheelhouse. I was able to absorb the concepts in this tutorial (especially as Jasper Flick, the author, really lays things out very well), but it’s definitely going to take some time and practice before building mathematical functions in applied cases like these feels more like second nature.

That said, let’s jump in!

## Project Details

**Project Goal:** Expand on the creation of mathematical functions in Unity by generating functions in complex shapes and surfaces**Tutorial Link:** Mathematical Surfaces at catlikecoding.com**Concepts Covered:** Building out and supporting multiple functions, explore the use of delegates and enums, display 2D functions with a grid, define 3D surfaces in space

## Expanding on the Graph Exercise

As I said above, this entire exercise builds on top of yesterday’s more straightforward graph exercise. The first concepts that really stood out to me as something I can make more use of were delegates and enums. The tutorial shows how to use these to make the inspector more user friendly by allowing for the selection of an actual function *name* rather than choosing from a numbered range and having to remember which was which.

Once those were all set up, the tutorial walked through creating additional functions, hooking them up into the logic of the code, and allowing them to be displayed dynamically depending on which was chosen in the inspector.

It was pretty fascinating to see how easy it can be (as long as you understand the mathematical formulae) to visualize some complex mathematical surfaces.

**Note:** Apologies for jitter in some of these gifs, my laptop had a little trouble keeping up with these simulations!

## Lessons Learned

Overall, the coolest thing I picked up in this tutorial was how to use delegates and enums to simplify the use of multiple functions throughout my code.

In addition, some of these functions gave me some ideas on how these might be applied to some interesting places in a game! I can imagine using mathematical functions in shaders to make water look like its flowing programmatically, or use sine wave visualizations to make a projectile look dynamic.