Example #1
0
        public void dBodyGetRotationTest()
        {
            IntPtr newWorldId = Ode.dWorldCreate();
            IntPtr newBodyId  = Ode.dBodyCreate(newWorldId);

            Ode.dMatrix3 r = new Ode.dMatrix3(
                new float[] {
                1.0f, 0.0f, 0.0f, 0.0f,
                0.0f, 1.0f, 0.0f, 0.0f,
                0.0f, 0.0f, 1.0f, 0.0f
            }
                );

            Ode.dMatrix3 r2
                = new Ode.dMatrix3(
                      new float[] {
                0.0f, 0.0f, 0.0f, 0.0f,
                0.0f, 0.0f, 0.0f, 0.0f,
                0.0f, 0.0f, 0.0f, 0.0f
            }
                      );

            Ode.dBodySetRotation(newBodyId, r);

            r2 = Ode.dBodyGetRotation(newBodyId);

            Assert.AreEqual(r, r2, "Assigned and returned rotation matrix values are not equal");
        }
Example #2
0
 public static void ToODE(ref Mat3 value, out Ode.dMatrix3 result)
 {
     result.M00 = value.Item0.X;
     result.M01 = value.Item1.X;
     result.M02 = value.Item2.X;
     result.M03 = 0;
     result.M10 = value.Item0.Y;
     result.M11 = value.Item1.Y;
     result.M12 = value.Item2.Y;
     result.M13 = 0;
     result.M20 = value.Item0.Z;
     result.M21 = value.Item1.Z;
     result.M22 = value.Item2.Z;
     result.M23 = 0;
 }
Example #3
0
        public void dBodySetRotationTest()
        {
            IntPtr newWorldId = Ode.dWorldCreate();
            IntPtr newBodyId  = Ode.dBodyCreate(newWorldId);

            Ode.dMatrix3 r = new Ode.dMatrix3(
                new float[] {
                1.0f, 0.0f, 0.0f, 0.0f,
                0.0f, 1.0f, 0.0f, 0.0f,
                0.0f, 0.0f, 1.0f, 0.0f
            }
                );
            try {
                Ode.dBodySetRotation(newBodyId, r);
            }
            catch (Exception e) {
                Assert.Fail("dBodySetRotation failed with exception: " + e.GetType());
            }
        }
Example #4
0
        public void dMassRotateTest()
        {
            Ode.dMass newMass = new Ode.dMass();
            newMass.c = new Ode.dVector4();             // Just to be safe the dMass
            newMass.I = new Ode.dMatrix3();             // structure is initialized

            Ode.dMassSetSphere(ref newMass, 0.2f, 3.5f);
            Ode.dMatrix3 r = new Ode.dMatrix3(
                new float[] {
                1.0f, 0.0f, 0.0f, 0.0f,
                0.0f, 1.0f, 0.0f, 0.0f,
                0.0f, 0.0f, 1.0f, 0.0f
            }
                );

            try {
                Ode.dMassRotate(ref newMass, r);
            }
            catch (Exception e) {
                Assert.Fail("dMassRotate failed with exception: " + e.GetType());
            }
        }
Example #5
0
        public void dGeomSetRotationTest()
        {
            IntPtr simplespace = Ode.dSimpleSpaceCreate(IntPtr.Zero);
            IntPtr box         = Ode.dCreateBox(
                simplespace, 25.0f, 5.0f, 25.0f
                );

            Ode.dMatrix3 r = new Ode.dMatrix3(
                new float[] {
                1.0f, 0.0f, 0.0f, 0.0f,
                0.0f, 1.0f, 0.0f, 0.0f,
                0.0f, 0.0f, 1.0f, 0.0f
            }
                );

            try {
                Ode.dGeomSetRotation(box, r);
            }
            catch (Exception e) {
                Assert.Fail("dGeomSetRotation failed with exception: " + e.GetType());
            }
        }