Results 1 to 3 of 3

Thread: Asteroids with OpenGL, matrix problem

  1. #1
    Guest

    Asteroids with OpenGL, matrix problem

    I'm running across an interesting problem in an Asteroids clone I'm working on. When I move my Ship by applying thrust, it moves as it should in the direction I'm pointed. However, when I rotate without applying thrust it behaves as if I do have thrust. In other words, I can make the ship move in a circle by applying thrust once and continually rotating.

    I believe this has to do with the fact that in OpenGL the rotation and transformation matrices are cumulative. How do I separate these behaviors so that I could thrust in one direction and rotate without thrust and still go in the same direction, in other words without modifying the coordinate system UNLESS thrust is being applied?

  2. #2
    Senior Member Regular Contributor
    Join Date
    Oct 2001
    Location
    Princeton, NJ
    Posts
    380

    Re: Asteroids with OpenGL, matrix problem

    sounds to me like you are going about it the wrong way. Instead of using a series of transfomation calls to move the ship, simply store its position and angle, then call glTranslatef and glRotatef once each per frame. This means you will need to do out the thrust mechanics yourself with sin and cos, but thats not a big deal. I hope I interpreted your post correctly

  3. #3
    Guest

    Re: Asteroids with OpenGL, matrix problem

    Interesting... Are you saying I should store X and Y on the ship, call glLoadIdentity to reset the coordinate system and then move it to X, Y (which is getting updated by me, not by modifying the coordinate system) performing the calculations myself?

    Sounds like it's what I'm going to have to do...

    Thanks

Similar Threads

  1. Asteroids
    By mikeglaz in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-26-2011, 02:08 PM
  2. asteroids
    By mikeglaz in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 06-17-2010, 12:53 PM
  3. 2D asteroids help please
    By mat01 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-24-2003, 09:09 AM
  4. 2D Asteroids Help Please
    By mat01 in forum OpenGL: User Software
    Replies: 1
    Last Post: 04-23-2003, 02:34 PM
  5. linked list-asteroids together
    By in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 06-14-2001, 08:08 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