yoshinoToylogic / bulletsharp

Automatically exported from code.google.com/p/bulletsharp
MIT License
0 stars 0 forks source link

GjkPairDetector problem #14

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi!

I hope you can help me :) .

I tried to calculate distance between two convex shape with the help of your 
bulletsharp.dll. I tried your xna example and it works well, but when I tried 
to calculate the distance with GJKPairDetector, I get a wrong distance :( .

The full function which calculate it:

ConvexShape closestShape1 = new BoxShape(1, 1, 1);
ConvexShape closestShape2 = new BoxShape(1, 1, 1);

VoronoiSimplexSolver vSimpSolver = new VoronoiSimplexSolver();
ConvexPenetrationDepthSolver epa = new GjkEpaPenetrationDepthSolver();
GjkPairDetector gjkPairDetector = new GjkPairDetector(closestShape1, 
closestShape2, vSimpSolver, epa);
Vector3 sepAxes = new Vector3(0f, 0.059727669f, 0.29259586f);
gjkPairDetector.CachedSeparatingAxis = sepAxes;

PointCollector output = new PointCollector();
GjkPairDetector.ClosestPointInput closestPointInput = new 
DiscreteCollisionDetectorInterface.ClosestPointInput();
closestPointInput.TransformA = Matrix.Identity;
closestPointInput.TransformB = Matrix.CreateTranslation(new Vector3(0, 5, 0));

gjkPairDetector.GetClosestPoints(closestPointInput, output, DebugDrawer);

I found something very strange here:

GjkPairDetector.ClosestPointInput closestPointInput = new 
DiscreteCollisionDetectorInterface.ClosestPointInput();

closestPointInput.TransformA = Matrix.Identity;
closestPointInput.TransformB = Matrix.CreateTranslation(new Vector3(0, 20, 0));

I debugged the last two lines, and after I set the TransformA or the 
TransformB, the values of them is the same, before I set them.

So I think, this is the reason, why I get wrong distance in the output, because 
this transforms my shapes into wrong places, instead of using my transform 
matrices.

Could You give me some idea, why is it happens? :(

Thanks in advance!

Best Regards,

Zoli

Original issue reported on code.google.com by zol.ba...@gmail.com on 30 Aug 2010 at 8:57

GoogleCodeExporter commented 8 years ago
I also get this problem in the SlimDX DistanceDemo on SVN, which is why it's 
not included in the demopack release. I'll let you know if I find the reason or 
solution...

Andres

Original comment by andres.traks on 1 Sep 2010 at 2:12

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r153.

Original comment by andres.traks on 3 Sep 2010 at 4:15

GoogleCodeExporter commented 8 years ago
Thank you!

Could you create a bulletsharp.dll for me with this new fixes?

Thanks in advance!

Regards,
Zoli

Original comment by zol.ba...@gmail.com on 3 Sep 2010 at 6:01

GoogleCodeExporter commented 8 years ago
I'll probably release 0.10 on Monday.

Thanks for the report!

Andres

Original comment by andres.traks on 3 Sep 2010 at 6:22