Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / Physics initial conditions problem

Author
Message
flashing snall
19
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 12th Jul 2011 17:41 Edited at: 12th Jul 2011 17:42
Hi
If this isn't the right place for these sorts of topics, please let me know, because I'm not sure where else I can post them.
I am working on a physics simulation, and its going pretty well. I've had this one particular problem for a long time, and I've brainstormed different solutions to the problem, but none of them seem very elegant or efficient.

The problem is my initial conditions for a collision. The collision response code picks up right when a collision is detected, but the collision detection code (and therefor the response code) only runs so often, because if it runs more often, it will bog down the system. Sometimes, an object will be found inside another object, which CAN cause some wierd issues.
The setup for this scenario is two blocks sitting next to eachother. The block on the right is spinning with considerable momentum. Here is a picture that shows the entire problem.



Any ideas?
Thanks.

Attachments

Login to view attachments
Plystire
22
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 12th Jul 2011 22:53
Could you backstep by small increments once the collision has been detected?

For example:
-Collision detected
- Backstep (reverse movement and rotation by small intervals) until collision is no longer detected
- Step forward by half of previous interval
- Perform collision routine based on this time frame


Not sure how that would play out in practice, but it's an idea. You would basically try to further estimate where the proper collision would be.


~Plystire

A rose is only a rose until it is held and cherished -- then it becomes a treasure.
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 12th Jul 2011 23:29
you have velocities per vertex and not just angular velocity?


Why does blue text appear every time you are near?
flashing snall
19
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 13th Jul 2011 00:30
No, there is a shape velocity, and an angular velocity (omega). But, the collision relies on the relative velocity between the two bodies at their point of intersection. So, for a vertex, that is
Vr = Vshape + omega*distance to point <-- roughly anyway.

Plystire, I've tried that and it seems to get really inefficient because it needs to call the SAT check a bunch of times which is really not computer friendly. I think its the only way to go about doing it though. But before I do that, I think Im going to try moving each body backwards along the collision normal by the penetration distance over two (two objects need to split the distance), THEN do the check, and then put the two bodies back to where they were. Im not sure if that will work, but its what Im going to try, just as soon as I get home from work.

Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 13th Jul 2011 01:31
Can't really help much, but I was wondering if you have ever used one of the big physics api's?

I'm not saying you should use one as I think it's great you are doing all this yourself. I was wondering whether you are aware that PhysX (and probably others) limit angular velocity?

It may be because of this issue, or maybe not. Have you thought about limiting anguar velocity? I know its not really a solution but if the big guys are doing it then there must be good reason.

They also say you do not need to have angular velocity limited for sphere/capsule shapes.

Another thing they do is have a skin on the shapes, so shapes are allowed to penetrate at a given depth set by the user, do you have anything like this?

You may know all this already, sorry I can't help more.

flashing snall
19
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 13th Jul 2011 05:21
I have tampered with max velocities and such, and they do prevent a lot of unpleasantness. I am not sure what you mean by having a penetration mask. Would you explain it a little more?

Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 13th Jul 2011 16:03
Quote: "Skin Width

The simulation deals with inaccuracy when stacking objects by letting them slightly inter penetrate each other. The amount of permitted inter penetration can be regulated at a scene level using a Skin Width parameter.

Clearly, a lot of inter penetration is visually undesirable. On the other hand, forbidding inter penetration is even worse, because objects may repel each other to the point where they separate, and then fall back down on each other in a subsequent time frame. This leads to visible jittering. The amount of inter penetration that is best permitted depends on many things such as the size of the objects involved (so that the inter penetrating region is visually negligible) but also on the stability of the simulation, which is usually governed by the gravity setting as well as the time step size. (Lower gravity and smaller time steps typically result in more stable simulations.)"


It seems skin width is important when objects are resting on top of each other etc, so it may not help with your problem.

Plystire
22
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 14th Jul 2011 07:25
Quote: "Plystire, I've tried that and it seems to get really inefficient because it needs to call the SAT check a bunch of times which is really not computer friendly."


Are you using any sort of math that isn't processor friendly (when performed in bulk)? Such as sqrt or any sort of trig?


~Plystire

A rose is only a rose until it is held and cherished -- then it becomes a treasure.
MrValentine
AGK Backer
14
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 31st Jul 2011 17:34
PhysX, give it a go

then again what language are you using?
DBPro?

Login to post a reply

Server time is: 2025-05-24 01:42:47
Your offset time is: 2025-05-24 01:42:47