Ejemplo n.º 1
0
        public void Test_New()
        {
            var phy = new PhysicsSimulator ();

            // 標準では PPM=64 だがユニットテストに限り PPM=1 で使用する。
               Assert.AreEqual (1, PhysicsSimulator.PPM);

            Assert.IsNotNull (phy.PhysicsWorld);
            Assert.AreEqual (new Vector3 (0, -9.8f, 0), phy.Gravity);
            Assert.AreEqual (0, phy.RigidBodyCount);
            Assert.AreEqual (0, phy.RigidBodies.Count ());
        }
Ejemplo n.º 2
0
        public void Test_IsRegistered()
        {
            var node = new Node ();
            var rb = new RigidBody ();
            rb.AddShape (new SphereShape (1));
            rb.Material = new PhysicsMaterial ();
            node.Attach (rb);

            var phys = new PhysicsSimulator ();
            phys.AddRigidBody (node);

            Assert.AreEqual (true, phys.IsRegistered(node));
        }
Ejemplo n.º 3
0
        public void Test_AddRigidBody()
        {
            var node = new Node ();
            var rb = new RigidBody ();
            rb.AddShape(new SphereShape (1));
            rb.Material = new PhysicsMaterial ();
            node.Attach (rb);

            var phys = new PhysicsSimulator ();
            phys.AddRigidBody (node);

            Assert.AreEqual (1, phys.RigidBodyCount);
            Assert.AreEqual (1, phys.RigidBodies.Count ());
        }