Results 1 to 4 of 4

Thread: Making camera follow character (2D)

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2009
    Posts
    21

    Making camera follow character (2D)

    I was just wondering what the easiest way to make the camera follow the user controlled character in a top down 2d game? I have found all these tutorials for 3D games but they all seem to be more complicated than I need them. All I want is a command to move the camera along the X and Y axis. Does it exist?

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Making camera follow character (2D)

    glTranslatef(x,y,0);

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2009
    Posts
    21

    Re: Making camera follow character (2D)

    Isn't that just for an object? I wanted to transform the camera viewpoint. Like in GTA how the camera follows the main character.

  4. #4
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Making camera follow character (2D)

    In fact modelview transformations are for both objects and viewpoint (model+view).

    Imagine your point of view is always fixed, and that all the objects translates with the same movement : this will look exactly the same as fixing the geometry, and only moving the point of view.

    There is a bunch of information in the faq :
    http://www.opengl.org/resources/faq/...formations.htm

Similar Threads

  1. Trouble making draw shapes follow mouse
    By throwaway in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 11-29-2013, 05:18 AM
  2. Getting a character to follow another
    By Random89 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-30-2009, 07:03 PM
  3. Camera follow object.
    By vantage in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 11-16-2007, 05:00 AM
  4. follow target with a camera
    By rogerdv in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-09-2005, 02:10 AM
  5. Making the camera follow the object
    By pmatos in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 01-16-2004, 11:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean