<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/13415" />

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2022-04-06T01:10:06+00:00</updated>

	<author><name><![CDATA[Real-Time Physics Simulation Forum]]></name></author>
	<id>https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/13415</id>

		<entry>
		<author><name><![CDATA[AisyJeff]]></name></author>
		<updated>2022-04-06T01:10:06+00:00</updated>

		<published>2022-04-06T01:10:06+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43973#p43973</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43973#p43973"/>
		<title type="html"><![CDATA[How to get multiple contact points between one object and multiple static object?]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43973#p43973"><![CDATA[
This code has worked before for one-to-one object. But I wanted to make one to multiple object contact. Multiple objects were created using the coordinates as in the code. this is my code, and I get some error because mis-use of probably the coordinates as a list, and I'm trying to put it as an argument in the contact points:<br><div class="codebox"><p>Code: </p><pre><code>import pybullet as pimport pybullet_dataimport timeobstacles_coor=[[-5,10,2.5],[2,10,2.5],[10,10,2.5],[0,5,2.5],[-10,-5,2.5]] physicsClient = p.connect(p.GUI)p.setAdditionalSearchPath(pybullet_data.getDataPath())p.loadURDF('plane.urdf', [0,0,0])p.setGravity(0,0,-10)for obs in obstacles_coor:    p.loadURDF("cube.urdf",obs,globalScaling=0.5)    p.setAdditionalSearchPath(pybullet_data.getDataPath())obstacles_coor.pop()cube=p.loadURDF("cube.urdf", [0,0,1])def contactPoints():      contacts = p.getContactPoints(bodyA=cube, bodyB=obs)      for contact in contacts:          link_index = contact[5]          if link_index &gt;= 0:                #p.removeBody(obstacles_coor[0])                #del(obstacles_coor.pop(0))                p.removeBody(obstacles_coor.pop(0))for i in range(10000):    p.stepSimulation()    contactPoints()    time.sleep(1./240.)</code></pre></div>The error jumps in line: <br><div class="codebox"><p>Code: </p><pre><code>contacts = p.getContactPoints(bodyA=cube, bodyB=obs)</code></pre></div>with the error log:<br><div class="codebox"><p>Code: </p><pre><code>Exception has occurred: TypeErroran integer is required (got type list)  File "C:\Users\AisyahJeff\niche_evo_single_species\old_model\test.py", line 60, in contactPoints    contacts = p.getContactPoints(bodyA=cube, bodyB=obs)  File "C:\Users\AisyahJeff\niche_evo_single_species\old_model\test.py", line 72, in &lt;module&gt;    contactPoints()</code></pre></div><p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=14299">AisyJeff</a> — Wed Apr 06, 2022 1:10 am</p><hr />
]]></content>
	</entry>
	</feed>
