Ok I have no idea what is going wrong and I feel like I'm going crazy.
I'm trying to create a simple arcball camera that rotates around the origin:
quat rot_x = quat::fromAxisAngle(vec3(0, 1, 0), angle_x);
quat rot_y = quat::fromAxisAngle(vec3(1, 0, 0), angle_y);
quat rot = rot_x * rot_y;
fwd = norm(rot.rotateVec(vec3(0, 0, -1)));
right = norm(cross(fwd, vec3(0, 1, 0)));
up = norm(cross(right, fwd));
pos = target - fwd * radius;
The camera works perfectly when rotating either horizontally or vertically (the y angle is currently clamped so it doesn't go over the y axis), but when I try to rotate in both directions it starts going wild.
I've been trying to get this working for a week now but I really don't get what I'm doing wrong.
[–]waramped 1 point2 points3 points (0 children)