for(int i=0; i<flag_cloth.vtxs(); i++)
{
Vec myPos = flag_cloth.lockRead()[i].pos;
flag_cloth.unlock();
if(i==407) // topleft corner index
{
clothparticle[i].pos.y = flagholderheight+0.6; // adjust according to current height
}
if(i==277) // bottomleft corner index
{
clothparticle[i].pos.y = flagholderheight-0.6; // adjust according to current height
}
if(( i!=407) && (i!=277)) // do not use topleft and bottomleft corners
clothparticle[i].pos = myPos;
//clothparticle[i].inverse_mass = 0.0f; // HAS NO EFFECT!!! (can be 0 or 1)
}
flag_cloth.set(clothparticle, flag_cloth.vtxs());
Game.World.update(Cam.at);
Physics.stopSimulation();