20 settembre 2022
We all love aim constraints. They are easy to set up and pretty powerful, if we know how to use them. But how is an aim constraint really working? That is actually a pretty simple logic, but exploring it is very interesting and will surely give you a good visual exercise for vector maths. First of all, to properly set up an aim constraint, we need three vectors : - Our base object vector . - An aim vector . - An up vector , in most of the 3D softwares the up vector, if not specified, is the y axis. The reason why we need an up vector is that when we are using euler angles (the x, y, z rotation system that we use every day to manipulate our objects) after 180 degrees, since the angle considered is always the smallest one, the other side is considered (essentially, if we are rotating 270 degrees for instance, the angle calculated would actually be the remaining 90°). Without going too complex to that, this leads to flipping , and setting an up vector essentially sets in which cases our object will flip. Relying on a custom up vector is useful because we can use for instance an object in our rig that is connected to the rest of the rig, so the up vector is changing every time the rig is transformed an this helps to reduce flipping. This is why the more complex system of quaternions was introduced. I won't cover quaternions in this article, as they are definitely on a more advanced side, but they are essentially 4 floats vectors . where 3 of the 4 components are not real numbers , but imaginary ones , that are not affected by the issue that I described above (and neither others, for instance gimbal lock, under certain circumstances).