コード例 #1
0
 def test_addCollisionObject(self):
     world = CollisionWorld()
     obj = CollisionObject()
     shape = SphereShape(3)
     obj.setCollisionShape(shape)
     world.addCollisionObject(obj)
     self.assertEqual(world.getNumCollisionObjects(), 1)
コード例 #2
0
ファイル: test_bullet.py プロジェクト: dgym/pybullet
 def test_addCollisionObject(self):
     world = CollisionWorld()
     obj = CollisionObject()
     shape = SphereShape(3)
     obj.setCollisionShape(shape)
     world.addCollisionObject(obj)
     self.assertEqual(world.getNumCollisionObjects(), 1)
コード例 #3
0
 def test_setCollisionShape(self):
     obj = CollisionObject()
     # Let go of the shape reference, it shouldn't matter.
     obj.setCollisionShape(SphereShape(3))
     shape = obj.getCollisionShape()
     self.assertTrue(isinstance(shape, SphereShape))
     self.assertEquals(shape.getRadius(), 3)
コード例 #4
0
ファイル: test_bullet.py プロジェクト: dgym/pybullet
 def test_setCollisionShape(self):
     obj = CollisionObject()
     # Let go of the shape reference, it shouldn't matter.
     obj.setCollisionShape(SphereShape(3))
     shape = obj.getCollisionShape()
     self.assertTrue(isinstance(shape, SphereShape))
     self.assertEquals(shape.getRadius(), 3)
コード例 #5
0
 def test_worldTransform(self):
     obj = CollisionObject()
     trans = Transform()
     trans.setOrigin(Vector3(3, 5, 7))
     obj.setWorldTransform(trans)
     origin = obj.getWorldTransform().getOrigin()
     self.assertEquals(origin.x, 3)
     self.assertEquals(origin.y, 5)
     self.assertEquals(origin.z, 7)
コード例 #6
0
ファイル: test_bullet.py プロジェクト: dgym/pybullet
 def test_worldTransform(self):
     obj = CollisionObject()
     trans = Transform()
     trans.setOrigin(Vector3(3, 5, 7))
     obj.setWorldTransform(trans)
     origin = obj.getWorldTransform().getOrigin()
     self.assertEquals(origin.x, 3)
     self.assertEquals(origin.y, 5)
     self.assertEquals(origin.z, 7)
コード例 #7
0
ファイル: test_bullet.py プロジェクト: dgym/pybullet
 def test_activationState(self):
     """
     CollisionObject.setActivationState changes an objects activation state
     and CollisionObject.getActivationState returns the current state.
     """
     for state in [ACTIVE_TAG, ISLAND_SLEEPING, WANTS_DEACTIVATION,
                   DISABLE_DEACTIVATION, DISABLE_SIMULATION]:
         obj = CollisionObject()
         obj.setActivationState(state)
         self.assertEqual(state, obj.getActivationState())
コード例 #8
0
 def test_activationState(self):
     """
     CollisionObject.setActivationState changes an objects activation state
     and CollisionObject.getActivationState returns the current state.
     """
     for state in [
             ACTIVE_TAG, ISLAND_SLEEPING, WANTS_DEACTIVATION,
             DISABLE_DEACTIVATION, DISABLE_SIMULATION
     ]:
         obj = CollisionObject()
         obj.setActivationState(state)
         self.assertEqual(state, obj.getActivationState())
コード例 #9
0
 def test_lines(self):
     """
     Some lines are drawn using the debug drawer when
     L{CollisionWorld.debugDrawWorld} is called.
     """
     obj = CollisionObject()
     shape = BoxShape(Vector3(1, 2, 3))
     obj.setCollisionShape(shape)
     self.world.addCollisionObject(obj)
     self.world.debugDrawWorld()
     self.assertTrue(len(self.recorder.lines) > 0)
     for line in self.recorder.lines:
         self.assertEquals(len(line), 9)
コード例 #10
0
ファイル: test_bullet.py プロジェクト: dgym/pybullet
 def test_lines(self):
     """
     Some lines are drawn using the debug drawer when
     L{CollisionWorld.debugDrawWorld} is called.
     """
     obj = CollisionObject()
     shape = BoxShape(Vector3(1, 2, 3))
     obj.setCollisionShape(shape)
     self.world.addCollisionObject(obj)
     self.world.debugDrawWorld()
     self.assertTrue(len(self.recorder.lines) > 0)
     for line in self.recorder.lines:
         self.assertEquals(len(line), 9)
コード例 #11
0
 def test_addBoxShape(self):
     world = CollisionWorld()
     obj = CollisionObject()
     shape = BoxShape(Vector3(2, 3, 4))
     obj.setCollisionShape(shape)
     world.addCollisionObject(obj)
コード例 #12
0
 def test_restitution(self):
     obj = CollisionObject()
     obj.setRestitution(1.0)
     self.assertEqual(obj.getRestitution(), 1.0)
コード例 #13
0
ファイル: test_bullet.py プロジェクト: dgym/pybullet
 def test_addBoxShape(self):
     world = CollisionWorld()
     obj = CollisionObject()
     shape = BoxShape(Vector3(2, 3, 4))
     obj.setCollisionShape(shape)
     world.addCollisionObject(obj)
コード例 #14
0
ファイル: test_bullet.py プロジェクト: dgym/pybullet
 def test_restitution(self):
     obj = CollisionObject()
     obj.setRestitution(1.0)
     self.assertEqual(obj.getRestitution(), 1.0)