flat assembler
Message board for the users of flat assembler.

Index > High Level Languages > Object rotation...

Thread Post new topic Reply to topic

Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
Thanks to dustwolf, i managed to get the nehe tutorial 10 modified to a point where the world moves in a sphere around me, but i still havn't gotten the rotation of the objects down, yet. I'm working with C++ code right now and converting it to assembly, later, so i can get input from non-asm programmers as well.

    //The following 3 lines is for the location... No problem here...
   xpos += (float)sin(xheading*piover180) * 0.005f * SPEED; 
   ypos += (float)sin(yheading*piover180) * 0.005f * SPEED;
    zpos += (float)(cos(xheading*piover180)*cos(yheading*piover180)) * 0.005f * SPEED;

      //This is where the problem is. The ifs were an attempt to fix
      //the issue with flipping upside-down and the left and right
        //movement get reversed. Worse yet, if you look up and turn
 //it's like you're spinning the z, not the y like i want.
 //So, my guess is that here is a good place to start.
  if (yheading>90 || yheading<-90)
 if (yheading>180)
      else if (yheading<-180)
    //Would look prettier near the location calculations, but
   //for some reson the effects are a bit awkward if i put
     //this before the rotation situation.
       glTranslatef(xpos, ypos, zpos);    

Worse yet, after i solve this i'm going to need to change the controls yet again, for i'm looking for some what of a "jet flight effect." The idea is, after fixing this, it might give me some idea on how to set up a system where i turn the world around me then go up or down to go right or left or diagonal, like your traditional flight simulator, but first i'll have to get an idea on how to get this out of neutral. Any ideas at this point would be appriciated.
Post 24 Jul 2007, 03:17
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.