Results 1 to 4 of 4

Thread: Camera Chase mode

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2002
    Location
    Leartherhead Surrey England
    Posts
    29

    Camera Chase mode

    Hi!

    I would like to implement a Camera chase mode. I have the 1st person and 3rd person
    examples from gamestutorials.com but I can;t figure out how to do this. Basically I want to draw my object (plane) and wherever I go I want the object to be in my line of sight. Can someone please help me do this?

    Thanks!

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,068

    Re: Camera Chase mode

    First look up on how to use vector math.

    example:

    v1 = view point
    v2 = object we are following
    v3 = camera rotation.

    gluLookAt(x1, y1, z1, x2, y2, z2, x3, y3, z3)


    We just find v1 based on the position of v2 which is the object we are following.

    Also we will have some distance to be keep between v1 and v2, and maybe some lag time during moving...

    so v1 = v2 - distance + rotation vector of 180, since we will be looking from behind the object at all times.


    Originally posted by fcoutel:
    Hi!

    I would like to implement a Camera chase mode. I have the 1st person and 3rd person
    examples from gamestutorials.com but I can;t figure out how to do this. Basically I want to draw my object (plane) and wherever I go I want the object to be in my line of sight. Can someone please help me do this?

    Thanks!


    [This message has been edited by nexusone (edited 11-14-2002).]

  3. #3
    Junior Member Newbie
    Join Date
    Aug 2002
    Location
    Leartherhead Surrey England
    Posts
    29

    Re: Camera Chase mode

    OK but how to I compute v1 from v2?, could you please give me an example?

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,068

    Re: Camera Chase mode

    Let's say the object we are following is moving North which we define as 0 degree direction.

    Our view will follow at 180 degree behind it, at 5 units distance.

    distance = 5;
    angle = 0 + 180;

    X1 = distance * cos( angle ) // note degrees must be converted to radians for the sin/cos function to work.
    Z1 = distance * sin( angle )

    Y1 & Y2 = // hight of view... 0 floor view, 1 midlevel view, 2 head view... numbers would need to be adjusted to world scale.

    More is needed to be added to the code for lag of camera following the object, etc.


    Originally posted by fcoutel:
    OK but how to I compute v1 from v2?, could you please give me an example?

Similar Threads

  1. [Camera] Can't make the camera move appropriately
    By onion_bread in forum OpenGL ES
    Replies: 0
    Last Post: 12-01-2011, 07:36 PM
  2. Acceralated mode vs. generic (soft) mode question
    By sharp in forum OpenGL: Windows
    Replies: 13
    Last Post: 12-01-2008, 06:15 PM
  3. Camera Position / Camera Angle / Camera Target Position
    By bobGL in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-02-2007, 09:28 AM
  4. How to do 2d Mode
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-03-2004, 06:06 PM
  5. Explain me: Immediate mode and Retained mode. In OGL and D3D!
    By Anonymous Coward in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 09-18-2000, 07:37 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