Math Magician – Path Smoothing with Chaikin

There are a lot of algorithms out there for making something follow a path. I should know, I’ve posted a couple. The thing is, a lot of times I find myself following a path just fine, but trying to make that path smooth is pretty frustrating. Some methods might take too long to execute, or don’t really work in realtime, or are just waaay too beefy for what I’m trying to do. So, I found a pretty simple algorithm for your Game-Dev-On-The-Go to help you find the way.

Alright, here’s the setting:

You have an enemy, he’s flying in space. He flies a basic patrol that selects a random path from a collection of waypoints. You generate your path, and it returns a List of Vector3s. Watching your enemy fly a path filled with extreme <90 degree turns looks dumb. Real dumb. You start to consider taking a job in construction, but wait; there's a simple solution: what if you could just cut out those sharp corners?

Well, that's when we call in Chaikin. Continue reading Math Magician – Path Smoothing with Chaikin

Advertisements

Math Magician – LookAt Algorithm

W00t! 2,000 views on the blog today! Probably most are spammers, but who cares? Still a victory!

Anyway, What I’m going to do is use this blog to not only rant about useless stuff I find interesting, but to also store code snippets and algorithms for later use in applications and such. And I guess I’ll share them too.

So, today, since it’s been a few years since College, I’m going to bone up on some of my math. I’m going to do a step-by-step of the LookAt Algorithm. Continue reading Math Magician – LookAt Algorithm