当我尝试运行示例PyBullet文件时,如下面所示,我一直得到以下错误消息:
import pybullet as p
from time import sleep
import pybullet_data
physicsClient = p.connect(p.GUI)
p.setAdditionalSearchPath(pybullet_data.getDataPath())
p.setGravity(0, 0, -10)
planeId = p.loadURDF("plane.urdf", [0,0,-2])
boxId = p.loadURDF("cube.urdf", [0,3,2],useMaximalCoordinates = True)
bunnyId = p.loadSoftBody("bunny.obj")#.obj")#.vtk")
useRealTimeSimulation = 1
if (useRealTimeSimulation):
p.setRealTimeSimulation(1)
p.changeDynamics(boxId,-1,mass=10)
while p.isConnected():
p.setGravity(0, 0, -10)
if (useRealTimeSimulation):
sleep(0.01) # Time in seconds.
else:
p.stepSimulation()
错误显示如下:
bunnyId = p.loadSoftBody("bunny.obj" # .obj" # .vtk")
错误:Cannot load soft body.
我有Windows 10。我在笔记本电脑(Python 3.6)上运行PyBullet,但我在Visual Studio (Python 3.7)上遇到了同样的错误。我能做些什么来修复它?
这是在https://github.com/bulletphysics/bullet3/pull/4010#issue-1035353580解决的问题,升级pybullet或将.obj文件从存储库复制到pybullet_data
目录就可以了。