1
0
Fork 0
mirror of https://git.freebsd.org/ports.git synced 2025-07-05 11:29:15 -04:00
ports/devel/py-bullet3/files/test.py
Yuri Victorovich 8f7ccf0124 devel/py-bullet3: Update 3.09 -> 3.17
Also:
* Add missing dependencies
* Add the test target based on the example from the documentation

Reported by:	portscout
2021-05-16 11:32:37 -07:00

17 lines
560 B
Python

import pybullet as p
import time
import pybullet_data
physicsClient = p.connect(p.GUI)#or p.DIRECT for non-graphical version
p.setAdditionalSearchPath(pybullet_data.getDataPath()) #optionally
p.setGravity(0,0,-10)
planeId = p.loadURDF("plane.urdf")
cubeStartPos = [0,0,1]
cubeStartOrientation = p.getQuaternionFromEuler([0,0,0])
boxId = p.loadURDF("r2d2.urdf",cubeStartPos, cubeStartOrientation)
for i in range (10000):
p.stepSimulation()
time.sleep(1./240.)
cubePos, cubeOrn = p.getBasePositionAndOrientation(boxId)
print(cubePos,cubeOrn)
p.disconnect()