Hot answers tagged

2

Alright so I figured out an even more ideal solution. The way I was trying to solve the problem was going to lead to more issues than I needed to deal with, so instead I slept on the problem and thought up a different approach. Instead of trying to min-max my orientation, I now calculate how far from the target orientation the camera is, If it lays above a ...


2

I bit on the mathematical side, but here's a Q & A on MSE on computing quanternion distance. Using that you could do something like: quat targetQuat = target->getOrientation(); quat currentQuat = getOrientation(); quat lerpQuat = glm::lerp(currentQuat, targetQuat, 0.05f); quat maximumQuat = targetQuat*quat(0.707, 0, -0.3535, 0); float d1 = ...


1

You can't get the "right" vector from just a "forward" vector. Any particular "forward" vector could have an infinite number of different legal "up" and "right" vectors. For example, if I am looking forward along the z axis forwardVector = vec3(0,0,1), then I could have up be along the y axis upVector = vec3(0,1,0) and right therefore be along the x axis ...


1

Simple method: Add two cameras to your scene, the first-person camera and the third-person camera. Attach both to the player-character. Move one on eye-height, the other further behind. Deactivate one of them. To switch between them, deactivate one and activate the other. This results in an immediate switch between the two perspectives. Fancier method: Have ...



Only top voted, non community-wiki answers of a minimum length are eligible