Moving the camera in a 3D space when camera is rotated (using Wikipedia Definition of 3D Projection)

StackOverflow https://stackoverflow.com/questions/5384640

문제

I wonder if someone could tell me how to make it possible to move a camera in a 3D space when the camera is rotated.

I am working on my own 3D engine (nothing fancy) and I can move the camera forward backward left right up down, thats all good. However when I rotate the camera, it doesnt move in the direction that the camera is directed to.

Here is a picture that should help you understand what I mean:

http://www.xaid.se/camrot.jpg

Does anybody know how to make this work?

(If you're interested in what I'm working on, visit this site)

도움이 되었습니까?

해결책

i'm not sure if i really get what you mean, but your problem looks like you want to move along the direction of the camera instead along one (main-)axis? therefore my solution would be to store a vector which keeps the direction the camera is looking, and update this vector everytime you rotate the camera. now you can use your direction vector for the forward movement. position + vector*stepsize. hope that helps a little bit.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top