Jump to content
Posted 10 May 2012 - 10:28 AM
Posted 10 May 2012 - 12:04 PM
I'm working with soft bodies using a physics engine. The soft bodies are simulated as tetrahedrons. My purpose is to unite 2 soft bodies that were once whole in the original mesh. In the simulator they are each a different entity . I thought that I should use spring physics to unite them. I used the following formula to unite the particles:
F = -kx -bv
where x is the difference between the 2 points that are attached by a string and v the difference of velocity between the two. My problem is that for a small k when I pull a softbody the other tends to follow slow, on the other hand if I increase the constant too much the two soft bodies move on their own but they stay attached correctly. I haven't been able to find a good value for a compromise. If someone can help me either with a new direction perhaps a different kind of force or another solution I would be very thank-full.
Edited by taby, 10 May 2012 - 12:11 PM.
Posted 10 May 2012 - 01:34 PM
Posted 10 May 2012 - 02:29 PM
Excuse me for the incomplete description. Yes x is the distance between particle positions , the complete formula should have been
F = -k(|x|-d)(x/|x|) - bv
where d should be the rest length. I don't know why using this formula makes both soft bodies move on their own(for a big k)
Edited by h4tt3n, 10 May 2012 - 02:31 PM.
Posted 10 May 2012 - 10:53 PM
Posted 10 May 2012 - 11:58 PM
Edited by h4tt3n, 11 May 2012 - 01:35 AM.
Posted 11 May 2012 - 01:43 AM
Posted 11 May 2012 - 06:33 PM
Posted 14 May 2012 - 12:27 AM
The physics engine does all the work, I interact with the soft bodies by just applying force through the interfaces it provides me. The forces are calculated for all the particles which are tied by such springs and are added before the simulation step is taken ( a call to a function simulate(time_step)). Other than through forces it allows me to set/get the each particle's velocity and position.
My advise would be to NOT add any new features such as angular damping before you've fixed this bug. How do you integrate force with time, ie. how do you get from force to velocity and position? THe error might hide here. Do you calculate force, acceleration, and new velocity and position for eaach particle before calculating force and so on for the next particle? If so, then this is wrong - calculate forces for all particles first, then all acceleration and so on. I've seen this behaiour from not doing so.
Posted 15 May 2012 - 05:59 AM
Edited by h4tt3n, 15 May 2012 - 06:00 AM.
Posted 17 May 2012 - 11:40 AM
Posted 17 May 2012 - 01:42 PM
Ok, so far so good.
I checked it , it happened the way you said it would.
What is this engine, you are using? What little workaround? It seems the problem is somewhere inside this "black box".
I also tried to tie the particles using some form of spring joints from the engine with a little work around, and it had the same effect ( tendency to move in one direction).
If all the physics is set up right, then this should not be a problem. It seems like you are violating Newton's laws of motion. Does all particles have the same mass? Is your engine based on force or impulse?
I'm beginning to believe that it could be due to the fact that the springs are made uneven ( n particles tied to m particles and no spring between the n or the m particles for stability).
Edited by h4tt3n, 17 May 2012 - 01:44 PM.
Posted 23 May 2012 - 11:42 PM
It's physX 2.8.1 ( because it still has soft bodies).
What is this engine, you are using?
I would if I could understand it all, but sadly at this time it's too late for me to do that. however I would really appreciate it if you could offer some samples on soft bodies. Perhaps I will find my mistake by understanding it .
I would strongly recommend you to code all physics yourself and not rely on ready-made physics engines.