Timewarp Rigid Body Simulation
I read Brian Mirtich''s article about using timewarping in a physics simulation. The long and short of it is that when penetration occurs between multiple rigid bodies, you roll that segment of your simulation back in time until just before the collision, and then commit the collision action, and then resume the simulation. I think it''s a great idea, and I''m inclined (a little physics humor there) to believe it can work, but I''m having problems with my own implementation:
Imagine two dominoes on a table. One just got knocked over and struck the second domino. Now they''re both falling onto the table. They''re also both in persistent contact. After initial contact, using timewarping, I end up having to roll back in intervals of like 0.00001 seconds. These intervals are so tiny, that because I use floating precision, my solver "breaks" because the limited precision causes the engine to think there is penetration when there should not be. I want to use double-precision, but there are two problems I have: One is I think it will kill simulation performance, and the other is that i still have a finite precision, and I will end up getting this problem, perhaps, in intervals of 0.00000000000001 seconds, instead.
I also don''t want to be moving my simulation in intervals of 0.00001 seconds; it will take forever to see anything move!
Has anyone ever successfully implemented a physics simulation
that supports timewarping, or a derivative of it?
Dragonslayer
There was a paper at SIGGRAPH a year or two ago that implemented something like this. It did work, but it wasn''t a real-time implementation.
Your dominoes example is an extreme case, and a naive implementation would obviously lead to this sort of situation. The thing to think about is, can you somehow predict that the dominoes will remain in contact for a certain length of time? And in the initial collision response can you constrain the directions of the dominoes after the collision to be such that they will not collide again for at least a significant number of frames? Sliding next to each other may be okay as long as you can know for some number of frames that you do not have to do another collision response. I think the goal is to do everything you can to make sure you only have to do collision response once in a while, and not every frame. That probably means that you cannot handle completely arbitrary situations. And if you do, you have to take some liberties and accept a solution that isn''t quite physically accurate.
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Your dominoes example is an extreme case, and a naive implementation would obviously lead to this sort of situation. The thing to think about is, can you somehow predict that the dominoes will remain in contact for a certain length of time? And in the initial collision response can you constrain the directions of the dominoes after the collision to be such that they will not collide again for at least a significant number of frames? Sliding next to each other may be okay as long as you can know for some number of frames that you do not have to do another collision response. I think the goal is to do everything you can to make sure you only have to do collision response once in a while, and not every frame. That probably means that you cannot handle completely arbitrary situations. And if you do, you have to take some liberties and accept a solution that isn''t quite physically accurate.
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
I did get two dominoes to topple correctly in a non-timewarp implementation by allowing some penetration, and calculating a force to counter the penetration (edge-face based collision detection)...but instead of going to rest at the end, they ultimately sank into each other after 15 seconds. In any event, I did do collision response every frame, so my thinking is wrong to being with.
Your points are all valid, but I still like the concept of the timewarp. Perhaps I will treat a timewarp that requires a rollback under a certain tolerance as a special case. In what way I will treat this case, I will have to think about. As you said, I must minimize the number of collision responses. I think I will approach it by first ensuring I can get it to work if I do a response every frame, then study the data and my existing algorithm, and then come up with a new, better response algorithm.
Your points are all valid, but I still like the concept of the timewarp. Perhaps I will treat a timewarp that requires a rollback under a certain tolerance as a special case. In what way I will treat this case, I will have to think about. As you said, I must minimize the number of collision responses. I think I will approach it by first ensuring I can get it to work if I do a response every frame, then study the data and my existing algorithm, and then come up with a new, better response algorithm.
Dragonslayer
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement