Is something wrong in btSubsimplexConvexCast

fishboy82
Posts: 91
Joined: Wed Jun 10, 2009 4:01 am

Is something wrong in btSubsimplexConvexCast

Post by fishboy82 »

Hi:
When I read btSubsimplexConvexCast that implement Gino's GJK convex sweep algo. I found something confused me the code Line is:
lambda = lambda - VdotW / VdotR;
//interpolate to next lambda
// x = s + lambda * r;
interpolatedTransA.getOrigin().setInterpolate3(fromA.getOrigin(),toA.getOrigin(),lambda);
interpolatedTransB.getOrigin().setInterpolate3(fromB.getOrigin(),toB.getOrigin(),lambda);
//m_simplexSolver->reset();
//check next line
w = supVertexA-supVertexB;
lastLambda = lambda;
n = v;
hasResult = true;
}
It seems strange because this is advanced the configration space's origin,but why w is still in the old configration space. Should we need to translate w in to the new configration space's that is w = w+(lambda * (lina-linb) something like this?
Vroonsh
Posts: 5
Joined: Wed Mar 17, 2010 4:09 pm

Re: Is something wrong in btSubsimplexConvexCast

Post by Vroonsh »

Hi,

You're right, I've had some weird Raytest Results due to this issue (Hit results outside the colliding shape)

Just after it you have this call :

Code: Select all

m_simplexSolver->addVertex( w, supVertexA , supVertexB);
So, you'll have to recalculate supVertexA and supVertexB before the w calculation :

Code: Select all

		if ( VdotW > btScalar(0.))
		{
			VdotR = v.dot(r);

			if (VdotR >= -(SIMD_EPSILON*SIMD_EPSILON))
				return false;
			else
			{
				lambda = lambda - VdotW / VdotR;
				//interpolate to next lambda
				//	x = s + lambda * r;
				interpolatedTransA.getOrigin().setInterpolate3(fromA.getOrigin(),toA.getOrigin(),lambda);
				interpolatedTransB.getOrigin().setInterpolate3(fromB.getOrigin(),toB.getOrigin(),lambda);
				//m_simplexSolver->reset();
				//check next line
:arrow:

Code: Select all

supVertexA = interpolatedTransA(m_convexA->localGetSupportingVertex(-v*interpolatedTransA.getBasis()));
supVertexB = interpolatedTransB(m_convexB->localGetSupportingVertex(v*interpolatedTransB.getBasis()));
:arrow:

Code: Select all

				w = supVertexA-supVertexB;
				lastLambda = lambda;
				n = v;
				hasResult = true;
			}
		} 
		m_simplexSolver->addVertex( w, supVertexA , supVertexB);
It solved my Raytest bug.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Is something wrong in btSubsimplexConvexCast

Post by Erwin Coumans »

It would be very helpful if you have a patch (using svn) and reproduction case for this (preferably filed in the issue tracker)

Could you help with this?
Thanks a lot,
Erwin
Vroonsh
Posts: 5
Joined: Wed Mar 17, 2010 4:09 pm

Re: Is something wrong in btSubsimplexConvexCast

Post by Vroonsh »

Hi Erwin,

Sorry for the delay, didn't saw your answer.

Please find the svn patch attached.

Based on the 2156 version

We Didn't test all the samples with this patch, seems to work properly with our game code.

Regards

Boris
You do not have the required permissions to view the files attached to this post.