Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8692015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:14:05+00:00 2026-06-13T00:14:05+00:00

I currently have a crystal ball interface camera set-up where the camera is always

  • 0

I currently have a crystal ball interface camera set-up where the camera is always looking at the origin and pressing left,right,up,down simply moves around the object.

I want to change this so that the camera can move around freely around the 3D environment.

I currently have two functions, LEFT and UP that have been implemented as the CB-interface I mentioned.

I want the left and right key to strafe left/right, while up/down to rise and sink the camera. How exactly would I go about changing it?

Also..what would be the proper way to move the camera forward and backward? I was thinking maybe draging the mouse could equate to moving foward/backward?

void Transform::left(float degrees, vec3& eye, vec3& up) {
eye = eye*rotate(degrees, up);
}


void Transform::up(float degrees, vec3& eye, vec3& up) {
vec3 ortho_axis = glm::cross(eye, up);
ortho_axis = glm::normalize(ortho_axis);

eye = eye*rotate(degrees, ortho_axis);
up = up*rotate(degrees, ortho_axis);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:14:06+00:00Added an answer on June 13, 2026 at 12:14 am

    Basically throw away the entire code and start over. The camera in your scene behaves like any other object and thus has a position and orientation. (Or one transform matrix.) All you need to do is apply the opposite of the camera transformation.

    glTransformf(-camera.x, -camera.y, -camera.z);
    glRotatef(-camera.angle, camera.axis.x, camera.axis.y, camera.axis.z);
    

    You get the idea.

    What I do in my code is, since I have quaternions for rotation and converting that into a matrix or axis & angle is expensive, I compute the the forward and up vectors for the camera and feed that into gluLookAt.

    Vector3f f = transform(camera.orientation, Vector3f(1, 0, 0));
    Vector3f u = transform(camera.orientation, Vector3f(0, 0, 1));
    Vector3f p = camera.position;
    Vector3f c = p + f;
    gluLookAt(p.x, p.y, p.z, c.x, c.y, c.z, u.x, u.y. u.z);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We currently have a set of crystal reports used for winforms projects embedded into
Currently have a drop down menu that is activated on a hover (from display:none
Suppressing lines in a cross tab crystal report We currently have a cross tab
I currently have a Database Command object in my Crystal Report that looks something
I have crystal report and I need to convert it to text file. Currently
I have a crystal report that currently shows data grouped twice. The first group
Currently have password protection on my main and sub directories, however I'd like to
I currently have a XSLT 2.0 Stylesheet that I am trying to remove empty
I currently have a table of concentrations, which are linked to a table of
I currently have one project that currently contains multiple packages. These packages make up

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.