Hey everyone,
This is my first post here obviously. I'm working on my first decent size Irrlicht project and I'm doing a Physics based racing game for a school project. I'm writing my own Physics for the game using a Runga Kutta 4 integrator and was wondering how everyone would recommend handling derivatives. I know that Irrlicht has built in Physics, so I would assume that there is some function to return a derivative. The reason I am not using built in physics is because the point of this project is to develop my own physics system (that's why I'm using RK4 integration).
Thanks
Getting Derivative
-
- Posts: 758
- Joined: Mon Mar 31, 2008 3:32 pm
- Location: Bulgaria
Re: Getting Derivative
Really?! Where?!soulflag wrote:I know that Irrlicht has built in Physics
And here`s a link, just to run away from just spamming around: http://irrlicht.sourceforge.net/forum/v ... &hilit=RK4
Neither RK4, nor Verlet or the other integration methods are rocket science. There are many articles and implementations. They are definitely not hard to understand. The hard part comes from the code that`ll be lying around them. And coding a decently working Physics system is a bit of pain, so good luck with that...
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
Re: Getting Derivative
RK4 is pretty simple I understand that completely and how to integrate using fouth order Runga Kuta, I just haven't found an efficient way to calculate derivatives in C++ yet. My physics system is actually nearly done and I'm having no problem understanding the physics I was just wondering if someone had a good way to calculate the derivative necessary for the integrator.
-
- Posts: 42
- Joined: Thu Jan 06, 2011 9:12 am
Re: Getting Derivative
I've just decided to work on the same thing. The method I planned to implement was to set up variables for values and exponents for the functions, and then using calculus rules to re-arange those numbers into the derivatives. My physics system isn't going to be very complex, it's just going to use polynomial curves, so I'm just using the method of multiplying the exponent by the coefficient, and then decreasing the exponent by one. You also will need to build in the product and quotient rule. That might not be in depth enough for your system, but it will totally work for figuring velocity and acceleration. I'm afraid I don't have it coded yet, but it's not as complicated as it sounds, you can use basically arrays if you want: one for the coefficients of the function, one for the exponents of the function, and then 2 more arrays for the same things for each derivative you want to figure.
I hope that makes sense. I might have time to code it and post it tomorrow or the next day, but right now I have to go to bed.
I hope that makes sense. I might have time to code it and post it tomorrow or the next day, but right now I have to go to bed.