Mesh - mesh collision detection in OPCODE
Page 1 of 1
Mesh - mesh collision detection in OPCODE
Hello everybody!!
This is the first time that I am posting a topic in this forum. I am currently using OPCODE for collision detection in virtual reality environment. As you may know that in OPCODE there is a 'collider' which collides with a triangle-mesh object. We can get the triangles (from the mesh surface) which are 'in contact' with the collider (I am using LSS and CapsuleMeshQuery as in CDTestFramework example). But, I wanted to get the contact triangles in the collider itself as well. According to the OPCODE user manual, there is a Mesh-mesh collision query that might fit my need. However, I am having difficulty while trying to understand the step and implement it, as there is no demo for this one.
Has anybody tried to implement mesh-mesh collision query, and retrieve the contact triangles from both the object and the collider? I would appreciate if I get your help on this.
- labrap
This is the first time that I am posting a topic in this forum. I am currently using OPCODE for collision detection in virtual reality environment. As you may know that in OPCODE there is a 'collider' which collides with a triangle-mesh object. We can get the triangles (from the mesh surface) which are 'in contact' with the collider (I am using LSS and CapsuleMeshQuery as in CDTestFramework example). But, I wanted to get the contact triangles in the collider itself as well. According to the OPCODE user manual, there is a Mesh-mesh collision query that might fit my need. However, I am having difficulty while trying to understand the step and implement it, as there is no demo for this one.
Has anybody tried to implement mesh-mesh collision query, and retrieve the contact triangles from both the object and the collider? I would appreciate if I get your help on this.
- labrap
labrap50- Guest
Re: Mesh - mesh collision detection in OPCODE
I have the same problem!mesh vs mesh using opcode ,there lost the demo
fengerfafa- Guest
Re: Mesh - mesh collision detection in OPCODE
If I understand your question correctly, for contact between, say obj1 and obj2, you want to get the collision triangles in both objects. Right?
Then it is not that difficult. Here is the main procedure:
Then it is not that difficult. Here is the main procedure:
- Code:
// suppose you have set up the collision environment for obj1 and obj2
bool IsOK = Collider.Collide(ColCache, &worldObj1, &worldObj2);
if (IsOK) {
// Get collision status => if true, objects overlap
if ( Collider.GetContactStatus() ) {
// Number of colliding pairs and list of pairs
int TriCount = Collider.GetNbPairs();
const Pair* CollidingPairs = Collider.GetPairs();
if (TriCount > 0) {
int id1, id2;
for(int i = 0; i< TriCount; i++){
id1 = CollidingPairs[i].id0;
id2 = CollidingPairs[i].id1;
Opcode::VertexPointers VP;
Opcode::ConversionArea VC;
// obj1.getMeshData()->m_Mesh returns the mesh you set for collision object
obj1.getMeshData()->m_Mesh.GetTriangle(VP, id1, VC);
// now you get the [i]i[/i]th triangle vertex information for obj1
// VP.Vertex[j]->x
// VP.Vertex[j]->y
// VP.Vertex[j]->z
// same for the other object obj2
obj2.getMeshData()->m_Mesh.GetTriangle(VP, id2, VC);
// now you get the [i]i[/i]th triangle vertex information for obj2
// VP.Vertex[j]->x
// VP.Vertex[j]->y
// VP.Vertex[j]->z
}
}
}
Hanz- Guest
Re: Mesh - mesh collision detection in OPCODE
Hello,
I am just beginner to OpCode and actually I do not have any idea about how to use it even could not configure it with visual studio 2005. I am trying to find a simple collision detection library too detect the collision between mesh and sphere.
please, can any one help me with how to start using opcode or any advice regarding which collision detection library will help me to get my project done.
Thank you,
I am just beginner to OpCode and actually I do not have any idea about how to use it even could not configure it with visual studio 2005. I am trying to find a simple collision detection library too detect the collision between mesh and sphere.
please, can any one help me with how to start using opcode or any advice regarding which collision detection library will help me to get my project done.
Thank you,
Zizo- Guest
Re: Mesh - mesh collision detection in OPCODE
I am trying to find a simple collision detection library too detect the collision between mesh and sphere.
Bullet collision detection can do that and it is pretty simple. You don't need to use the rigid body or soft body dynamics, they are separate libraries.
Either setup a btCollisionWorld and perform the queries, or go more low-level if needed.
Thanks,
Erwin
Erwin Coumans- Guest
Similar topics
» Simple Mesh-Mesh collision
» OPCODE Collision Detection Library, example code
» Accuracy of OPCODE
» How can I contact the developer of OPCODE?
» OPCODE Collision Detection Library, example code
» Accuracy of OPCODE
» How can I contact the developer of OPCODE?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|