Page 1 of 1

using CompoundChildData

Posted: Thu Mar 22, 2012 9:57 pm
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.

Re: using CompoundChildData

Posted: Thu Mar 22, 2012 10:34 pm
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.

Re: using CompoundChildData

Posted: Fri Mar 23, 2012 4:15 pm
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.

Re: using CompoundChildData

Posted: Fri Mar 23, 2012 4:20 pm
by Peter Prins
It's unfortunate that structs don't allow paramererless constructors, or I would sugest making it private.