Page 1 of 1
Debug Render?
Posted: Mon Jan 18, 2010 11:21 am
by Danthekilla
Hey i was just wondering if there was any kind of debug render in bepu.
I have written my own at the moment but its buggy and doesnt work on all bepu objects.
Is there any built in that i have missed?
Re: Debug Render?
Posted: Mon Jan 18, 2010 12:25 pm
by Danthekilla
I thought i would just post a image of what it currently looks like and was hopeing to improve on.
And the code that i use to do it.
And here is the code.
Code: Select all
for (int i = 0; i < space.updateables.Count; i++)
{
if (space.updateables[i] is StaticTriangleGroup)
{
TriangleMeshVertex[] temp = ((StaticTriangleGroup)space.updateables[i]).triangleMesh.vertices;
int[] tempIndices = ((StaticTriangleGroup)space.updateables[i]).triangleMesh.indices;
for (int j = 0; j < tempIndices.Length - 1; j += 2)
{
if (j + 1 > g_Constants.GET.MaxDebugLines - 5)
return;
Lines.Add(temp[tempIndices[j]].position, temp[tempIndices[j + 1]].position, new Color(Color.Red,50));
}
}
}
I am sure that you can see the issue...
Im not sure if im doing it right but perhaps there is a better way?
.
.
.
Re: Debug Render?
Posted: Mon Jan 18, 2010 7:25 pm
by Norbo
There's a sort-of-debug renderer in the BEPUphysics demos project (source can be downloaded here:
http://www.bepu-games.com/BEPUphysics/downloads.htm).
As far as meshes are concerned, all it does is use basic effect to render them with an optional wireframe mode.
Re: Debug Render?
Posted: Mon Jan 25, 2010 11:56 pm
by mattbettcher
Dan:
Why not use TriangleRenderHelper from the SunBurn Framework? You could submit triangles using the index data and get a near perfect overlay I would think. If your not using SunBurn (you should start) the code will still work with any effect. Actually, the code is somewhere on their website. If your interested I can send you a copy or find it for you.