SharpDx / Bepu integration

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
sueds
Posts: 43
Joined: Tue Feb 05, 2008 10:40 am

SharpDx / Bepu integration

Post by sueds »

I'm having some problem with sharpdx and bepu. Do you have any idea how to convert the worltransform value properly the object keep rotation in a weird way. Maybe it's a problem with the static object because at the beginning of the simulation everything works just fine. Basically I spawn 40 cubes in a random position over a static mesh which is 60 by 60, with a height of 10. I use for the surface ( floor) and the box a simple entity prefab box. So when the first collision occurs nothing seems weird but then the box start floating around and I really don't know what's wrong. I basically followed the basic example and use a box created in the code to draw the boxes.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: SharpDx / Bepu integration

Post by Norbo »

The 'box floating around' thing sounds like the graphic is offset from the collision shape. This will happen if, for example, the box model's origin is at the bottom of the box. Since the box shape's origin is in the center, the graphical model will be misaligned by half of the width of the box. To fix that, ensure that the graphical model has the same origin as the physics shape. This can be done either at content building time or by using a local graphics offset to bring it into alignment with the local space of the physics shape before applying the world transform.
sueds
Posts: 43
Joined: Tue Feb 05, 2008 10:40 am

Re: SharpDx / Bepu integration

Post by sueds »

Ok, I'll try to look into it. But the problem is that I did try with both importer model ( using a one to one model) and a generated model with vertices matching the size of the box so I'm not sure if the problem lies in this area. I'll try to keep looking. But basically the problem is not coming from the conversion bepu to sharpDx. That's a good news.
sueds
Posts: 43
Joined: Tue Feb 05, 2008 10:40 am

Re: SharpDx / Bepu integration

Post by sueds »

I did try the bepu drawer helper but the result is the same. So I still don't understand what could be the problem. I just follow the basic setup example. But I got the weird swimming behavior from the box shape.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: SharpDx / Bepu integration

Post by Norbo »

Unfortunately, I don't have enough information to provide much more assistance; I am not sure if what I am visualizing is even close to what you see.
Post Reply