Hi there.
I am currently building a cloth solver and have just got onto external collision handling. For internal collision I am using the same pbd approach they show off in the grains masterclass.
I thought I would go about external collisions a similar way, using a gas collision detect
I get the incidence vector and reflect it. Then add the resulting reflected vector to the position.
if (i@hitnum)
{
vector incidence= v@hitpos-v@P;
float mag=length(incidence);
vector reflection= reflect(normalize(incidence), normalize(v@hitnml));
v@P+=reflection*mag;
}
The cloth still blows up, even at a high substep
Annoyingly a simple
if (i@hitnum)
v@P=v@hitpos;
seems to work worlds better albeit the colliding points get stuck in place (which is something I aimed to fix by setting the new position to the reflected vector). The reason I'm not using the gas integrator to handle this for me is because I was looking to learn how this system is implemented.
What is the correct way to go about this?
As always any help is greatly appreciated
Thanks