Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have a user's position in my game. I have a 3dof controller which moves my user in a 3d space.

I have 2 vectors cameraPosition and where to lookAt. Now for a simple case I have setup the position as follows:

    cameraPos.x=godObjPos.x + 2;
    lookAt.x=godObjPos.x - 2;

enter image description here

How should I change the x and y cordinates of both cameraPos and lookAt to simulate the user turning his head towards left or right?

I set up the keyboard keys a and s to change the angle: a when pressed reduces the angle and s when pressed increases the angle.

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.