test_bullet_wheel.py 792 B

123456789101112131415161718192021222324252627
  1. import pytest
  2. from pytest import approx
  3. # Skip these tests if we can't import bullet.
  4. bullet = pytest.importorskip("panda3d.bullet")
  5. from panda3d.core import Vec3
  6. from panda3d.bullet import BulletWorld
  7. from panda3d.bullet import BulletBoxShape
  8. from panda3d.bullet import BulletRigidBodyNode
  9. from panda3d.bullet import BulletVehicle
  10. def test_get_steering():
  11. world = BulletWorld()
  12. # Chassis
  13. shape = BulletBoxShape(Vec3(0.6, 1.4, 0.5))
  14. body = BulletRigidBodyNode('Vehicle')
  15. body.addShape(shape)
  16. world.attach(body)
  17. # Vehicle
  18. vehicle = BulletVehicle(world, body)
  19. world.attachVehicle(vehicle)
  20. # Wheel
  21. wheel = vehicle.createWheel()
  22. wheel.setSteering(30.0)
  23. # Returns the steering angle in degrees.
  24. assert wheel.getSteering() == approx(30.0)