Motion prediction with collision

Post Reply
User avatar
pccsoares
Posts: 13
Joined: Mon Jan 20, 2014 11:57 am
Contact:

Motion prediction with collision

Post by pccsoares »

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?
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: Motion prediction with collision

Post by Basroil »

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
User avatar
pccsoares
Posts: 13
Joined: Mon Jan 20, 2014 11:57 am
Contact:

Re: Motion prediction with collision

Post by pccsoares »

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.
c6burns
Posts: 149
Joined: Fri May 24, 2013 6:08 am

Re: Motion prediction with collision

Post by c6burns »

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.
Post Reply