Debug Render?

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Danthekilla
Posts: 136
Joined: Sun Jan 17, 2010 11:35 am

Debug Render?

Post 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?
Danthekilla
Posts: 136
Joined: Sun Jan 17, 2010 11:35 am

Re: Debug Render?

Post 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.

Image

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?


.
.
.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Debug Render?

Post 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.
mattbettcher
Posts: 7
Joined: Sun Mar 08, 2009 12:51 am

Re: Debug Render?

Post 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.
Post Reply