Custumizing physics ?
Posted: Mon May 02, 2016 9:59 am
Hi everyone !
I'm a beginner bullet user, and I'm trying to figure out how to get the best out of it for a simulation that I'm building. Like a lot of beginners, I'm having a few issues with accuracy and simulations blowing. It's part of the fun
I'm trying to simulate orbit. So far, nothing to hard. The thing is, that some extreme values, or a too big timestep can easily break the "standard" method of calculating the gravity force (F=G*m1*m2/R^2) on each timestep. Since you're revolving around a body, the direction of the force varies continuously, but since you're applying a single fixed force for the duration of a timestep, you might either drift slowly to a different orbit geometry, or (that's the fun one) you might reach escape velocity just because of the way the integrator did it's job over the course of one timestep which wasn't accurate enough (too long) and the resulting force too big.
I hope what I'm saying is understandable enough...
Anyways, since orbiting is something you might want to do for a long time, the more time passes, the more your orbit parameters change when they're supposed to be completely stable in an ideal environment.
So I've had an idea... instead of using a force to make a lookalike orbit that'll always be unstable, why not take another approach: the orbit could be "plotted" from the orbital parameters (easy enough) and then other forces (like a thruster) be computed the "normal" way.
This brings me to my question(s):
- What shall I be implementing ? a custom solver ? a custom constraint ? a custom integrator ? None of those ?
- Is it really bad practice to feed a body with a position on each step ? could this help me solve this ?
I understand that all this seems a little confused, bear with me...
Cheers,
Marc.
I'm a beginner bullet user, and I'm trying to figure out how to get the best out of it for a simulation that I'm building. Like a lot of beginners, I'm having a few issues with accuracy and simulations blowing. It's part of the fun
I'm trying to simulate orbit. So far, nothing to hard. The thing is, that some extreme values, or a too big timestep can easily break the "standard" method of calculating the gravity force (F=G*m1*m2/R^2) on each timestep. Since you're revolving around a body, the direction of the force varies continuously, but since you're applying a single fixed force for the duration of a timestep, you might either drift slowly to a different orbit geometry, or (that's the fun one) you might reach escape velocity just because of the way the integrator did it's job over the course of one timestep which wasn't accurate enough (too long) and the resulting force too big.
I hope what I'm saying is understandable enough...
Anyways, since orbiting is something you might want to do for a long time, the more time passes, the more your orbit parameters change when they're supposed to be completely stable in an ideal environment.
So I've had an idea... instead of using a force to make a lookalike orbit that'll always be unstable, why not take another approach: the orbit could be "plotted" from the orbital parameters (easy enough) and then other forces (like a thruster) be computed the "normal" way.
This brings me to my question(s):
- What shall I be implementing ? a custom solver ? a custom constraint ? a custom integrator ? None of those ?
- Is it really bad practice to feed a body with a position on each step ? could this help me solve this ?
I understand that all this seems a little confused, bear with me...
Cheers,
Marc.