Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contact type is confusing #84

Open
FantasyVR opened this issue Feb 15, 2020 · 0 comments
Open

Contact type is confusing #84

FantasyVR opened this issue Feb 15, 2020 · 0 comments

Comments

@FantasyVR
Copy link

FantasyVR commented Feb 15, 2020

The contact type in

static const unsigned int ParticleContactType = 1;

is not useful at all and should be deleted, although it's not really used in the code.

I assume that

is consist with it.

Thus, I think it should be corrected as follows:

static const unsigned int RigidBodyContactType = 0;
static const unsigned int ParticleRigidBodyContactType = 1;		
static const unsigned int ParticleSolidContactType = 2;

To be clear when reading the source code, I think it's better to use static value when creating contacts_mt and contact constraints in void DistanceFieldCollisionDetection::collisionDetection(SimulationModel &model) such as

for (unsigned int i = 0; i < contacts_mt.size(); i++)

	for (unsigned int i = 0; i < contacts_mt.size(); i++)
	{
		for (unsigned int j = 0; j < contacts_mt[i].size(); j++)
		{
			if (contacts_mt[i][j].m_type == CollisionDetection::ParticleRigidBodyContactType)
				addParticleRigidBodyContact(contacts_mt[i][j].m_index1, contacts_mt[i][j].m_index2,
					contacts_mt[i][j].m_cp1, contacts_mt[i][j].m_cp2, contacts_mt[i][j].m_normal,
					contacts_mt[i][j].m_dist, contacts_mt[i][j].m_restitution, contacts_mt[i][j].m_friction);
			else if (contacts_mt[i][j].m_type == CollisionDetection::RigidBodyContactType)
				addRigidBodyContact(contacts_mt[i][j].m_index1, contacts_mt[i][j].m_index2,
					contacts_mt[i][j].m_cp1, contacts_mt[i][j].m_cp2, contacts_mt[i][j].m_normal,
					contacts_mt[i][j].m_dist, contacts_mt[i][j].m_restitution, contacts_mt[i][j].m_friction);
			else if (contacts_mt[i][j].m_type == CollisionDetection::ParticleSolidContactType)
			{
				addParticleSolidContact(contacts_mt[i][j].m_index1, contacts_mt[i][j].m_index2,
					contacts_mt[i][j].m_elementIndex2, contacts_mt[i][j].m_bary2,
					contacts_mt[i][j].m_cp1, contacts_mt[i][j].m_cp2, contacts_mt[i][j].m_normal,					
					contacts_mt[i][j].m_dist, contacts_mt[i][j].m_restitution, contacts_mt[i][j].m_friction);
				m_tempContacts.push_back(contacts_mt[i][j]);
			}
		}
	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant