Code: Select all
import pybullet as p
import pybullet_data
import time
physicsClient = p.connect(p.GUI)
p.setAdditionalSearchPath(pybullet_data.getDataPath())
p.loadURDF('plane.urdf', [0,0,0])
cube1=p.loadURDF("cube.urdf", [0,0,1])
lego=p.loadURDF("cube.urdf", [0,0,4])
p.setGravity(0,0,-10)
def contactPoints(self):
contacts = p.getContactPoints(bodyA=self.cube1, bodyB=self.lego)
for contact in contacts:
link_index = contact[2]
if link_index >= 0:
p.removeBody(self.lego)
for i in range(10000):
p.stepSimulation()
time.sleep(1./240.)
Hopefully anyone can help me with this. It seems simple but I can't get it done