[ODE] Crash in OPCODE OPC_SphereCollider.cpp

Bram Stolk bram at sara.nl
Wed Jun 7 01:05:44 MST 2006


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


More information about the ODE mailing list