logoalt Hacker News

nananana9today at 2:22 PM1 replyview on HN

I'd pretty much always store pitch/yaw for a first/third person controller. This makes it trivial to modify the values in response to input - `pitch += mouse_delta.y` and to clamp the pitch to a sane range (-90 to 90 deg) afterwards.

You can then calculate a quaternion from the pitch/yaw and do whatever additional transforms you wish (e.g. temporary rotation for recoil, or roll when peeking around a corner).


Replies

the__alchemisttoday at 5:10 PM

Interesting. I do it in quaternion, but mostly work in unclamped 6DOF systems.