Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!

#ActualBrother Bob

Posted 22 July 2013 - 12:06 PM

I was helping someone else on another thread to get a model of his rotating towards where he touches the screen with his finger.  Since I already had your code pasted into a simple framework I decided to work on his using the ship code we have been working on.  Here are the results so far.  It is still in the preliminary stages but it is working. 



void Render(void)


//============================= - The next seven lines of code seems to have round 1 taken care of.
incrementTime += 0.001;  
       distanceBetweenModels[1] = ship_02_POSITION[1] - ship_01_POSITION[1];                              
       distanceBetweenModels[0] = ship_02_POSITION[0] - ship_01_POSITION[0];                                    
       targetRotation = atan2(distanceBetweenModels[0], distanceBetweenModels[1])* 180 / 3.14159;        
       blendedRotation = (startRotation * (1.0 - sliderTime)) + (targetRotation * sliderTime);                        
       if(sliderTime <= 1.0) // This will prevent the rotation from over-shooting
             sliderTime += incrementTime;                                                                                                
              DrawShip(ship_01_POSITION_X, ship_01_POSITION_Y, ship_01_POSITION_Z, ship_01_ROTATION, ship_01_COLOR);
             DrawShip(ship_02_POSITION_X, ship_02_POSITION_Y, ship_02_POSITION_Z, ship_02_ROTATION, ship_02_COLOR);



What happens here is ship_01 rotates towards ship_02 when the program starts up.  There is nothing yet to update the program so that it will keep happening as the program parameters changes.  It is basically, for now,  a two frame animation that causes a smooth rotation to take place.  It has to be updated still so that it can be an infinite number of frames that take place one after the other as things progress.  We'll have to see how this goes but I think it will work better than my other solutions up to this point.


Posted 22 July 2013 - 03:09 AM

There is far too much arrogance and out right abuse by site moderators, they are teaching other people to behave this way.  The posts I've made will all be shorty removed and replaced with this notice.  Game development is not the only thing being taught here, bad behavior is being taught as well.