C# AimConstraint in Unity

So I was taking a look at this great procedural animation tutorial and I was surprised that he used C# to aim the geckos head instead of using the aimConstraint that is available in unity.

But I decided that it was a worthwhile exercise to recreate the aimConstraint since I hadn't gotten to work with matrices in unity yet, and I needed to get some practice on working with it's left handed coordinate system and column-based matrices.

into things. It took some time reading the documentation (to find out that the matrix is column-based not row based) but I got everything working the way I wanted.

It was a very easy excercise math-wise since I've done this sort of thing many times in Maya, but finding out how Unity wants you to think was very insightful. Maya is very matrix-centric while Unity seems more quaternion-centric, which is a great change of pace.

Featured Posts
Recent Posts
Archive