using CompoundChildData

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Peter Prins
Posts: 54
Joined: Fri Mar 11, 2011 11:44 pm

using CompoundChildData

Post by Peter Prins »

Hello,

I'm trying to use CompoundChildData structs to create a Compound body as follows:

Code: Select all

EntityCollidable newShape = new CompoundCollidable(new List<CompoundChildData>()
{
    new CompoundChildData
    {
        Entry = new CompoundShapeEntry(
            new SphereShape(2),
            new RigidTransform(),
            1000f),
        //Events = null,
        //CollisionRules = new BEPUphysics.CollisionRuleManagement.CollisionRules(),
        Material = new Material(1f, .5f, .2f),
        Tag = null,
    },
});
Entity entity = new Entity(newShape, 1000f);
However, the graphic from the ModelDrawer doesn't properly match up with this thing, and I'm getting the feeling it isn't even the right shape, as it seems I can crush it into a space of 2-3 units in width.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: using CompoundChildData

Post by Norbo »

Copying that into the BEPUphysicsDemos seems to work as expected (a very heavy sphere, 4 units across). The ModelDrawer coincides with the shape.

What do you see, and what do you expect to see? Also, if you can reproduce it in the demos, I could take a closer look.
Peter Prins
Posts: 54
Joined: Fri Mar 11, 2011 11:44 pm

Re: using CompoundChildData

Post by Peter Prins »

I found The problem: I was using new RigidTransform() instead of RigidTransform.Identity, which causes the quaternion to be initialized with 0f values.
Last edited by Peter Prins on Fri Mar 23, 2012 4:21 pm, edited 1 time in total.
Peter Prins
Posts: 54
Joined: Fri Mar 11, 2011 11:44 pm

Re: using CompoundChildData

Post by Peter Prins »

It's unfortunate that structs don't allow paramererless constructors, or I would sugest making it private.
Post Reply