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

  • SEARCH
  • Home
  • 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 9208681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:40:08+00:00 2026-06-18T00:40:08+00:00

I want to make my camera move behind the model when it rotates, just

  • 0

I want to make my camera move behind the model when it rotates, just like in a Third Person Perspective game – to have it “look” always on the back of the model. Im provided with a framework so the syntax may be bit different than normal opengl. I use the standard camera

Mat4 mv = MatrixMath.lookAt(this.eyeX,this.eyeY,this.eyeZ,this.at,this.up);

and to rotate the camera i tried

this.mouseRotation += 20.0f;
this.eyeX = (float) Math.sin(this.mouseRotation / 180.0f * 3.14f) * 2.0f;
this.eyeZ = (float) Math.cos(this.mouseRotation / 180.0f * 3.14f) * 2.0f;

mouseRotation is the angle which the model is located so obviously the camera should be also move to a position located 20 degrees further on the “circle”. But instead of this the object rotates around itself, and the camera makes a circular movement but not around the model, but next to it, still looking at the same point.

Any ideas how to make this work?

  • 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-18T00:40:09+00:00Added an answer on June 18, 2026 at 12:40 am

    From your example, I believe the short answer is to add this.at (which should be the position of your object) into your this.eye so that that the eye is positioned relative to the object.

    In more detail, say your object’s position is at this.at, and you want the camera to follow the object at some distance, say ‘d’ “behind” the object. If you have a unit vector (i.e., one’s whose length is 1.0) pointing out of the front of the object, then the this.at - d should be the position of the camera (i.e., this.eye). In order to get the camera to rotate around the object, first apply a rotation to ‘d’ (in the example above, you appear to be rotating around the ‘Y’ axis [since you’re only modifying eyeX and eyeZ]), so that

    this.eye = this.at - rotation(Y) * d; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a camera activity. I want to make it looks like the default
I want to make ball collision with camera bounds. Does OpenGL ES api have
I want to make a first person 3d game but I can't set the
I'm trying to make a camera app using AVCaptureSession. For now I just want
I have a wireless IP camera and I want to make my own web
I'm writing a 2d game and I have birds in a camera-space. I want
I am trying to make a game in OpenGL and want to move the
I have an object that moves and rotates, and I want the camera to
I have style sheet with a class name changebackgroundcolor i want make change in
I have link for example domain.com/de/controler/action?param=value and I want make actionlink to keep same

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.