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 6805121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:32:54+00:00 2026-05-26T19:32:54+00:00

Ok so here is the problem, I found a nice working 2D Camera from:

  • 0

Ok so here is the problem, I found a nice working 2D Camera from:

http://www.david-amador.com/2009/10/xna-camera-2d-with-zoom-and-rotation/

So now, I have implemented it into my 2D Top-Down Shooter game and it works nicely. When I have the camera position equal that of the player position, it works perfectly; to an extent. Now when I have the camera position = the player position, it jerks around a little bit like this:

http://www.youtube.com/watch?v=mh4Tx9xg324

As you can see the sprite goes and then goes back a little bit. I will give a rough example:
If the player position is (100, 100) I move to the right and it goes to (120, 100). Now all the numbers are fine, its the visualization. The visualization seems like this:

(100, 100) -> (130, 100) -> (120, 100)

I have no idea why it is doing this and it bugs me to the point that it is all that I am working on to fix. Now when I have the camera centered on a point (1000, 1000), the player doesn’t jerk around as such. So this makes everything point directly at the Camera2D Class.

Anyway, if anyone could help it would be greatly appreciated!

  • Bobby

** EDIT **
Movement Code:

    //Update Movement for user controlled sprites
    //A bit rough around the edges at the moment...
    public void UpdateMovement(Input input) {
        //Get ready to point sprite at mouse location in relation to the center of the screen
        MouseState mouse = Mouse.GetState();
        mouseLoc = new Vector2(mouse.X, mouse.Y);

        direction = new Vector2(512, 300) - mouseLoc;
        angle = (float)((Math.Atan2(-direction.Y, -direction.X)));

        m_Rotation = angle;
        //End angle information

        //reset the changed vector 2 back to zero
        changed = Vector2.Zero;

        //checkCollision(vector2)
        //it gets the estimated new point and if it doesnt hit a wall
        //it sets to the new point.
        if (input.CurrentKeyboardState.IsKeyDown(Keys.A)) {
            changed.X = -m_Speed;
            if (!checkCollision(changed)) {
                m_Position += changed;
            }
        }

        if (input.CurrentKeyboardState.IsKeyDown(Keys.D)) {
            changed.X = m_Speed;
            if (!checkCollision(changed)) {
                m_Position += changed;
            }
        }

        if (input.CurrentKeyboardState.IsKeyDown(Keys.W)) {
            changed.Y = -m_Speed;
            if (!checkCollision(changed)) {
                m_Position += changed;
            }
        }

        if (input.CurrentKeyboardState.IsKeyDown(Keys.S)) {
            changed.Y = m_Speed;
            if (!checkCollision(changed)) {
                m_Position += changed;
            }
        }
    }
  • 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-05-26T19:32:55+00:00Added an answer on May 26, 2026 at 7:32 pm

    Thanks to the help provided at http://xnachat.com/ , i was able to quickly fix the problem.

    How:

    I passed the camera to the player rather than setting the camera position over and over I just added the changed vector to the camera position.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found this code from here: http://www.cssportal.com/form-elements/text-box.htm But the problem is you can still
Basically my problem is that i've adapted a piece of code found here http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/thread/62e70670-f306-4bb7-8684-549979af91c1
Related to a question I asked earlier here , I've found a problem which
Here is a hum-dinger of a problem that I have not found an answer
I've got a problem here with an MSI deployment that I'm working on (using
So here I believe I have a small buffer overflow problem I found when
I browsed around here on Stackoverflow and found this topic : https://stackoverflow.com/questions/279/aspnet-visual-studio-and-subversion-how-to-integrate However that
I found this nice memoizing decorator: http://wiki.python.org/moin/PythonDecoratorLibrary#Memoize The particular application is in artificial intelligence,
I have a nice easy problem for you here. This is a nice easy
I'm trying to use inheritance in JavaScript here, and I found problem having array

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.