Solid & Orientation

Topics: User Forum
Mar 6, 2007 at 4:11 PM
Hi there again,

I'm really cunfused. My problem is I want to render a model with the solid orientation.

I create a Solid with a boxshape:
solid = simulator.CreateSolid();
solid.LinearDamping = 0.2f;
Matrix transform = Matrix.Identity * Matrix.CreateRotationZ(MathHelper.ToRadians(10));
transform.Translation = position + new Vector3(0,200,0);
solid.Transform = transform;
boxData = new BoxShapeData();
boxData.Dimensions = new Vector3(50.0f, 50.0f, 50.0f);
boxData.Material.Hardness = 0.2f;
boxData.Material.Bounciness = 0.6f;
boxData.Material.Friction = 1.0f;
boxData.Material.Density = 0.4f;

The Box falls correctly and the direction is also correct, but when the solid collide with a plan, the direction go wrong. The box rotate extremly.

Here is the part where I define the Worldmatrix:

currenteffect.Parameters["World"].SetValue(Matrix.Identity *
                        Matrix.CreateFromQuaternion(orientation) *

This is the plane:

planeSolid = simulator.CreateSolid();
            //planeSolid.LinearDamping = 0.2f;
            Matrix transform = Matrix.Identity;
            transform.Translation = new Vector3(0,0,0);
            planeSolid.Transform = transform;
            planeSolid.Static = true;
            PlaneShapeData planeShape = new PlaneShapeData(new Microsoft.Xna.Framework.Plane(0, 1, 0, 0));

What do I wrong?

I want a simple box (rotated) which falls and collide with the plane.

Thank you
Mar 6, 2007 at 5:21 PM
First off, you should look at Matrix conversion for XPA ODE it uses it in some different way... you can see it in Physics.test project...
Secondly there might be some bugs with plane shapes I didn't tested it...
Mar 6, 2007 at 6:18 PM
Okay, I will try it tomorrow. Thank you.