-
Notifications
You must be signed in to change notification settings - Fork 68
Description
When trying to use axis rotation input for gfc_matrix4_from_vectors, I found that the x rotation input labeled "about the x axis" was actually rotating the model about the y axis, and vice versa. Simply creating a new vector to input with the swapped values fixed this.
The same applied for getting gfc_vector3d_angle_vectors2 to work as intended, along with some additional modification. I had to duplicate the function (so as to not modify gfc) and swapped the x and y angle calculations within the function (to avoid having to swap them on the input). I also found that in this function, the right and forward vectors were swapped, and some of the code required sign changes. The modified portion is this:
...
angle = angles.y;
sp = sinf(angle);
cp = cosf(angle);
angle = angles.x;
sr = sinf(angle);
cr = cosf(angle);
if (forward)
{
forward->x = (-1 * sr * sp * cy + -1 * cr * -sy);
forward->y = (-1 * sr * sp * sy + -1 * cr * cy);
forward->z = -1 * sr * cp;
}
if (right)
{
right->x = -1 * cp * cy;
right->y = -1 * cp * sy;
right->z = sp;
}
if (up)
{
up->x = (cr * sp * cy + -sr * -sy);
up->y = (cr * sp * sy + -sr * cy);
up->z = cr * cp;
}
Note: These issues arose from my experience only, I have not verified if anyone else experienced these issues. I submitted this as a gf3d issue since they're more easily tested in gf3d despite being a part of gfc.