I have been trying to predict the movement of my sphere X frames ahead in time.
I tried to use predictIntegratedTransform from the body to get the future position, but collisions are not being taken in account.
I just want to predict where my ball will be in the X next frames in future, after colliding with the floor.
Is there a way to do this with the bullet library?
Motion prediction with collision
Re: Motion prediction with collision
Well, you could just do the brute force approach where you just simulate as many frames ahead as you want. Other than that though, it's a non-trivial problem once you consider collision, at least compared to just gravity and "constant" forces like friction
Re: Motion prediction with collision
but how can I simulate X frames ahead by using the engine?
I have reached a solution by creating a parallel world with a replica of the ball and the floor. Each time I call stepSimulation on my first world I have call the same method X times on my second world to reach X frames ahead. And it works great, but it might be overkill.
I have reached a solution by creating a parallel world with a replica of the ball and the floor. Each time I call stepSimulation on my first world I have call the same method X times on my second world to reach X frames ahead. And it works great, but it might be overkill.
Re: Motion prediction with collision
I don't see how else you would solve the problem. How else would you know where a rigidbody would end up unless you consider all the factors being considered in stepSimulation?
The only way you could skip having 2 simulations, as I see it, is if you aren't processing input that affects the simulation.
The only way you could skip having 2 simulations, as I see it, is if you aren't processing input that affects the simulation.