I have been following a tutorial that I found here on gamedev.net, but it is written in C#, and I am using C, so I am trying to translate everything into C. The tutorial I am following is here: http://www.gamedev.n...ysics-tutorial/
I did the first part and got what looks like a working rigid body simulator, I could apply a force vector and an offset vector and it moved in a way that looked sane. So I moved on to the rest of the tutorial, and I think I translated all the code pretty well, but then as soon as I ran my executable, everything went crazy.
I spent all of 3 days of free time (not that much with class and both of my jobs) looking for bugs. And I can't seem to find any. I found some discrepancies with the vector math in the tutorial and what I read, so I changed my functions to match the ones on the tutorial, and it almost worked, till I tried to use an angle other than 0.
Oh, I'm also using Linux and SDL2. It should compile easily on Windows if you have SDL2, my code is pretty portable.
Anyways, I'll attach the code, take a look at it and see if you can find any problems with my math. You should probably check my rigid body code, just in case I did something wrong but it just looked right to me.
Thank you in advance, I love you.
EDIT:: I posted updated code. The size is also smaller since I left out some unnecessary images. but the other file (a few posts down) has some code I left out before (accidentally) and includes a makefile so it should be enough to compile if you have SDL2.
Edited by prushik, 21 October 2012 - 03:19 AM.