Page 1 of 1

BoundingBoxDrawer not working for me

Posted: Thu Feb 02, 2012 5:29 pm
by Poncho
Hi,

I am new to Bepu and am just trying to get a simple demo working with different sized boxes (with "Box" collision meshes) falling to the ground, I am trying to use TriangleMesh for constructing the ground's collision mesh.

This isn't working, and when the boxes are small they seem to fall through other boxes so I thought I'd try using the BoundingBoxDrawer from the demos to draw the bounding boxes of the objects.

My problem is the BoundingBoxDrawer doesn't seem to be drawing anything.

Here are the important parts of my code:

Code: Select all

//At the top
//#Bepu
        Space space;
        BoundingBoxDrawer bepuBoundingBoxDrawer;
        BasicEffect bepuDrawer;

//...in Initialize() :

//#Bepu
            space = new Space();
            space.ForceUpdater.Gravity = new Vector3(0, -9.81f, 0);

            bepuBoundingBoxDrawer = new BoundingBoxDrawer(this);
            bepuDrawer = new BasicEffect(GraphicsDevice);

//...in Draw() :

bepuDrawer.LightingEnabled = false;
            bepuDrawer.VertexColorEnabled = true;
            bepuDrawer.World = Matrix.Identity;
            bepuDrawer.View = CurrentCamera.View;
            bepuDrawer.Projection = CurrentCamera.Projection;

            bepuBoundingBoxDrawer.Draw(bepuDrawer, space);
I am adding the collisions to Space fine and when I step into BoundingBoxDrawer.Draw() there are elements in Space.Entities.

Is there something with my camera and where the BoundingBoxDrawer thinks it should be creating the World Matrix?

Any ideas anyone?

Thanks for your time,

Poncho

Re: BoundingBoxDrawer not working for me

Posted: Thu Feb 02, 2012 6:20 pm
by Garold
I had a similar problem once. My advice would be to use the demo and modify that code. The model drawer works perfectly there. That's what I did. When I got my code working fine I then removed my code from the demo to create a separate project.

Re: BoundingBoxDrawer not working for me

Posted: Thu Feb 02, 2012 7:05 pm
by Poncho
Hmm, thanks for the response but I'd rather not. Even changing the basicEffect that the Drawer uses' View and Projection matrices to default (looking at 0, 0, 0 which is where I start drawing my stuff anyway) still didn't do anything.

Re: BoundingBoxDrawer not working for me

Posted: Thu Feb 02, 2012 9:27 pm
by Norbo
I don't see anything wrong in the posted code, so I'd assume there's something else involved. It sounds like the graphics are transformed away from the proper locations in some way, but I can't be sure of it or in what way it is offset.

With the current information, I'd suggest simplifying the drawing/simulation until the issue can be pinpointed. Using the demos' model drawer could help a bit here, as could putting subsets of the simulation into a demo just to rule things out.

Re: BoundingBoxDrawer not working for me

Posted: Fri Feb 03, 2012 9:42 am
by Poncho
Ah okay, I'll started hunting around my drawing code then, I was hoping I had just missed out an important line of code or something (damn!) heh.

Thanks anyway guys, I'll report back if I find anything of use to anyone else.

Poncho

Re: BoundingBoxDrawer not working for me

Posted: Fri Dec 07, 2012 9:47 pm
by humanfoosh
Hi,
I seem to be having a similar problem, the bounding box does not draw for me,
Did you ever find out what you were missing?
Appreciate any help!
Thanks

Re: BoundingBoxDrawer not working for me

Posted: Fri Dec 07, 2012 9:56 pm
by Norbo
I may be able to help given more information, but keep in mind that the physics library itself is totally unaware of graphics. Any graphics system can be used to represent the physics.