<?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/10001" />

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2014-07-07T19:39:20+00:00</updated>

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

		<entry>
		<author><name><![CDATA[Pacha]]></name></author>
		<updated>2014-07-07T19:39:20+00:00</updated>

		<published>2014-07-07T19:39:20+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=33653#p33653</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=33653#p33653"/>
		<title type="html"><![CDATA[btPersistentManifold returns 0 contacts (getNumContacts)]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=33653#p33653"><![CDATA[
I am using a contact manifold to do some normal processing. It sometimes returns 0 when calling getNumContacts().<br><br>Thanks.<br><div class="codebox"><p>Code: </p><pre><code>static_cast&lt;PlayerController*&gt;(world-&gt;getWorldUserInfo())-&gt;_clearTouchingPlatforms();int numManifolds = world-&gt;getDispatcher()-&gt;getNumManifolds();DEBUG_PRINT(3, %d, numManifolds);for (int i=0;i&lt;numManifolds;i++){btPersistentManifold* contactManifold =  world-&gt;getDispatcher()-&gt;getManifoldByIndexInternal(i);const btCollisionObject* obA = (contactManifold-&gt;getBody0());const btCollisionObject* obB = (contactManifold-&gt;getBody1());auto body = static_cast&lt;PlayerController*&gt;(world-&gt;getWorldUserInfo())-&gt;getBody();if (obA == body || obB == body){int numContacts = contactManifold-&gt;getNumContacts();DEBUG_PRINT(4, %d, numContacts);for (int j=0;j&lt;numContacts;j++){auto normal = TO_OGRE(contactManifold-&gt;getContactPoint(j).m_normalWorldOnB * (obB == body ? -1 : 1));if (obA-&gt;platformPointer){static_cast&lt;PlayerController*&gt;(world-&gt;getWorldUserInfo())-&gt;_addTouchingPlatform(obA-&gt;platformPointer, normal);}if (obB-&gt;platformPointer){static_cast&lt;PlayerController*&gt;(world-&gt;getWorldUserInfo())-&gt;_addTouchingPlatform(obB-&gt;platformPointer, normal);}//if (pt.getDistance()&lt;0.f)//{//btVector3 normalOnB = pt.m_normalWorldOnB;//if (obB == body)//{//normalOnB *= -1;//}////static_cast&lt;PlayerController*&gt;(world-&gt;getWorldUserInfo())-&gt;_addNormal(normalOnB);//}}}}</code></pre></div><p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=10282">Pacha</a> — Mon Jul 07, 2014 7:39 pm</p><hr />
]]></content>
	</entry>
	</feed>
