Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualJinixVomitorium

Posted 02 January 2013 - 03:15 AM

Ive never used openGL but if the theory is the same, you need to constantly compair the coordinates of the front, back, left, right of your cars with one another, then set up conditions when the cars are toutching to apply the collision physics.

 

//checks if the x coordinates of both objects are within the same range

"if (starting car1 x > starting car2 x ) and (ending car1 x < ending car 1 x) then

{

     ///// checks if y coordinates of both objects are in the same range

      if (srarting car1 y > starting car2 y) and (ending car1 y < ending car2 y) then

     {

           ///apply physics

     }

}

 

the theory is the same for the track. though i think you would need to change the ands to ors and reverse the symbols.

since you have a curved track you may need to use an algorything to calculate the points on the curve to compair to.


#1JinixVomitorium

Posted 02 January 2013 - 03:12 AM

Ive never used openGL but if the theory is the same, you need to constantly compair the coordinates of the front, back, left, right of your cars with one another, then set up conditions when the cars are toutching to apply the collision physics.

 

//checks if the x coordinates of both objects are within the same range

"if (starting car1 x > starting car2 x ) and (ending car1 x < ending car 1 x) then

{

     ///// checks if y coordinates of both objects are in the same range

      if (srarting car1 y > starting car2 y) and (ending car1 y < ending car2 y) then

     {

           ///apply physics

     }

}


PARTNERS