Results 1 to 7 of 7

Thread: Unreal Style Motion

  1. #1

    Unreal Style Motion

    So I'm taking this OpenGL class, and we run Redhat Linux, and I have to create a scene. I want to look around it with the mouse and move with the arrows, just like in the games. I know glutSpecialFunc and glutPassiveMotionFunc, but I'm not sure how to pull it all together. So is there something you know that I don't, Frankie?

  2. #2
    Guest

    Re: Unreal Style Motion

    I know what you mean. When using glutMotionFunc and glutPassiveMotionFunc, the mouse cursor is limited to the bounds of the screen. To get around this, find how much the mouse moved (aka mouse delta; platform specific if you want it to be), center the cursor (platform specific), and then move whatever is connected to the mouse (gun, head, etc) based on the mouse delta.

  3. #3

    Re: Unreal Style Motion

    Ok. More specifically, do I want the camera to move? or the scene? If i want the camera to move, how to i rotate and translate it smoothly and easily?

  4. #4

  5. #5
    Senior Member Frequent Contributor
    Join Date
    Aug 2001
    Location
    Italy
    Posts
    625

    Re: Unreal Style Motion

    Please stop about this quaternion stuff. Using quaternions to manage observers is simply a waste of time.

    Proof 1: I had a speak with a person which made a whole tutorial about quaternions. He told me quaternions are really not needed for this (he told me they rock for other things, but not there).

    Proof 2: Take a look at the Q2 (or Q1)source code. It uses eulerian angles and since this maps to OpenGL quite easily, I really don't know why to use other things.


    As for moving correctly and "easily" the only thing I can say I actually mantain a "foward" and a "right" vector but too much time has passed since I made this stuff and I don't remember anymore (wrapped in a class which has NEVER been modified again).

    Now, the object it's used in way like that:
    Code :
    observer.AddAngles(mouse.movement.deltaX * MOUSE_SPEED, mouse.movement.deltaY * MOUSE_SPEED, .0f); // I actually don't roll.
    observer.MoveFoward(foward * MOVEMENT_SPEED *  framePeriod);
    observer.MoveRight(/* similar to the above */);
    /* Similar things to move backward and left */
    Now, this works pretty fine most of the time and I don't need to work with quaternions. I guess working with trigonometric functions is much easier.

  6. #6
    Guest

    Re: Unreal Style Motion

    gluLookAt() can be used to simulate a camera. Also you could just do something similar to this (this may or may not be the proper way, I use gluLookAt myself):

    glLoadIdentity() //can't remember if this is necessary
    glTranslate(camPosition)
    glRotate(camOrientation.x,1,0,0)
    glRotate(camOrientation.y,0,1,0)
    glRotate(camOrientation.z,0,0,1)
    glPushMatrix()
    drawScene()
    glPopMatrix()

  7. #7

    Re: Unreal Style Motion

    Ok. Now i need to keep the mouse centered at all times. Running redhat. Coding in c++. Any ideas?

Similar Threads

  1. Unreal importer bug
    By Zoltan in forum COLLADA
    Replies: 10
    Last Post: 11-12-2007, 03:02 AM
  2. C++ Style or C Style? Error on compiling...
    By DarkBrute in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 03-23-2005, 02:14 AM
  3. Unreal II and OpenGL
    By Jdeuce in forum OpenGL: User Software
    Replies: 2
    Last Post: 07-20-2003, 06:27 PM
  4. Rendering multiple Unreal-style skyboxes in a scene
    By timmie in forum OpenGL: Advanced Coding
    Replies: 13
    Last Post: 01-31-2003, 09:31 PM
  5. Unreal Tournament
    By IoNzToRM in forum OpenGL: User Software
    Replies: 1
    Last Post: 08-26-2001, 06:49 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