I have been hit with the sniffles, so this week I did not GTD or TCB (in a flash) (like Elvis). I did manage to do a smidge of pair programming with Isabel in C#/unity. We created functions to open things: boxes, doors, other stuff (I cant remember). Isabel is creating a game in unity so this was a small part of her larger project but I learned a few things.

First, my programming muscle memory had some issues adjusting to the German keyboard. The Z is in a different space – so ctrl z was hard.

Second, I have an ancient version of unity installed on my laptop. BUT I knew this.

Third, Quaternions Quaternions! When you rotate an object in unity, say like a door hinging (rotating) on an axis, you use Quaternions or Euler Angles. We were using quaternions because I believe we were doing transformations on angles. Euler angles are x,y,z – our three dimensional world. Quaternions are x,y,z,w. A poor explanation is that this represents that axis vector and the angle (2 cos^{-1} w) that we are going to use to rotate around. A truer explanation is that it is a projection of a complex number into four dimensions. I have zero intuition as to what this means and would probably have to spend a week doing math to get the beginning of a handle on what is going on.

Why Quaternions?

From the documentation:

[Quaternions] are compact, don’t suffer from gimbal lock and can easily be interpolated. Unity internally uses Quaternions to represent all rotations.

What is Gimbal lock? From the documentation:

Euler angles suffer from Gimbal Lock. When applying the three rotations in turn, it is possible for the first or second rotation to result in the third axis pointing in the same direction as one of the previous axes. This means a “degree of freedom” has been lost, because the third rotation value cannot be applied around a unique axis.

Fourth, State. how do you know when the door has finished opening say 90 degrees. There is no callback. What we ended up doing was adding conditionals in the update function (which is run every frame), to see if the door/lid passed the ‘open’ or ‘closed’ threshold. Not super elegant, but according to stackoverflow and other internet resources this is what you do!.

This was fun, it combined two things I love about RC – pair programming & being exposed to something new (e.g unity). I feel less intimidated by unity.

Isabel introduced me to this cool new game sharing site – itch – and I was reminded of my favorite low fi gaming platform TWINE! I love twine.