O'Reilly logo

Creating E-Learning Games with Unity by David Horachek

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing the SplineMgr class

Recall from our requirements that our NPC needs to be able to walk about the world along an arbitrary path. A convenient way to author the curve information would be by placing waypoints in the scene in the Unity3D Editor. Then, by interpolating between these points, we can apply smooth motion to the NPC object. It turns out that our SplineMgr is able to generate a curve that interpolates through all of the waypoints (or ControlPoints) in a set. Great news!

There are numerous types of splines in the mathematical world; each one has its own unique properties. Some of them don't interpolate any but get really close. Others will interpolate the first and the last, and approximate the middle two. By using a specific ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required