[ODE] Crash in OPCODE OPC_SphereCollider.cpp

Tibor Szabo tibor at scssoft.com
Wed Jun 7 05:07:06 MST 2006


Hi Bram,

yes, it's the mesh with just one triangle. The AABBtree is not generated 
for such simple case. So it shouldn't be used in the 
SphereCollider::Collide.
See attached test case.

Tibor

>Tibor Szabo wrote:
>  
>
>>Hi!
>>
>>There seems to be a problem with the single-triangle mesh vs. sphere
>>collision test. Such simple mesh does not have the AABBCollisionTree!
>>
>>This special case is solved in the HybridSphereCollider::Collide but not
>>in the SphereCollider::Collide. See attached patch for details...
>>    
>>
>
>Hi Tibor,
>
>thanks for the patch....
>
>I was wondering... did you have a test case?
>Because ode/test/test_basket.cpp uses a single mesh and a sphere,
>and it works for us.
>
>When you say "single-triangle mesh" you mean that there is 1 mesh, right,
>and not just 1 triangle?
>
>I would like to understand the bug more, and then fix it. Currently
>we are into release candidates, and I'm more hesitant with applying
>fixes.
>
>thx
>
>  Bram
>
>  
>
>>t.
>>
>>
>>------------------------------------------------------------------------
>>
>>Index: OPC_SphereCollider.cpp
>>===================================================================
>>--- OPC_SphereCollider.cpp	(revision 981)
>>+++ OPC_SphereCollider.cpp	(working copy)
>>@@ -99,6 +99,20 @@
>> 	// Init collision query
>> 	if(InitQuery(cache, sphere, worlds, worldm))	return true;
>> 
>>+	// Special case for 1-leaf trees
>>+	if(mCurrentModel && mCurrentModel->HasSingleNode())
>>+	{
>>+		// Here we're supposed to perform a normal query, except our tree has a single node, i.e. just a few triangles
>>+		udword Nb = mIMesh->GetNbTriangles();
>>+
>>+		// Loop through all triangles
>>+		for(udword i=0;i<Nb;i++)
>>+		{
>>+			SPHERE_PRIM(i, OPC_CONTACT)
>>+		}
>>+		return true;
>>+	}
>>+
>> 	if(!model.HasLeafNodes())
>> 	{
>> 		if(model.IsQuantized())
>>
>>
>>------------------------------------------------------------------------
>>
>>_______________________________________________
>>ODE mailing list
>>ODE at q12.org
>>http://q12.org/mailman/listinfo/ode
>>    
>>

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test_basket.cpp
Url: http://q12.org/pipermail/ode/attachments/20060607/13a197d7/test_basket-0001.bat


More information about the ODE mailing list