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

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

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

		<entry>
		<author><name><![CDATA[Pacha]]></name></author>
		<updated>2014-04-14T02:06:01+00:00</updated>

		<published>2014-04-14T02:06:01+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=33300#p33300</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=33300#p33300"/>
		<title type="html"><![CDATA[Bug with wrong normals on edges in btBvhTriangleMeshShape]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=33300#p33300"><![CDATA[
Video of the bug:<br><a href="https://www.youtube.com/watch?v=VCtwTpABrQo" class="postlink">https://www.youtube.com/watch?v=VCtwTpABrQo</a><br><br>I have the following situation, a couple of btCollisionObjects, and a btRigidBody. When the btRigidBody is falling vertically without horizontal speed, the normals are calculated wrongly and it gets through the collision objects on the edges. There are 2 normals in the contact manifold (btManifoldPoint) with inverse normals (0, -1, 0), and it passes through the collision object (see the video for reference). This only happens when falling at a relative high speed and crashes in a place with an edge, and sometimes when jumping at the same spot with edges vertically. It works well when not touching the edges when falling.<br><br>You can see in the video, top left, the normals (inverted ones when falling through, normal ones when no bugs). I am using btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK on all my bodies, and this is my gContactAddedCallback function:<br><div class="codebox"><p>Code: </p><pre><code>static bool CustomMaterialCombinerCallback(btManifoldPoint&amp; cp,const btCollisionObjectWrapper* colObj0Wrap,int partId0,int index0,const btCollisionObjectWrapper* colObj1Wrap,int partId1,int index1){btAdjustInternalEdgeContacts(cp,colObj1Wrap,colObj0Wrap, partId1,index1);//if (enable){//btAdjustInternalEdgeContacts(cp,colObj1,colObj0, partId1,index1, BT_TRIANGLE_CONVEX_BACKFACE_MODE);//btAdjustInternalEdgeContacts(cp,colObj1,colObj0, partId1,index1, BT_TRIANGLE_CONVEX_DOUBLE_SIDED+BT_TRIANGLE_CONCAVE_DOUBLE_SIDED);}float friction0 = colObj0Wrap-&gt;getCollisionObject()-&gt;getFriction();float friction1 = colObj1Wrap-&gt;getCollisionObject()-&gt;getFriction();float restitution0 = colObj0Wrap-&gt;getCollisionObject()-&gt;getRestitution();float restitution1 = colObj1Wrap-&gt;getCollisionObject()-&gt;getRestitution();if (colObj0Wrap-&gt;getCollisionObject()-&gt;getCollisionFlags() &amp; btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK){friction0 = 1.0;//partId0,index0restitution0 = 0.f;}if (colObj1Wrap-&gt;getCollisionObject()-&gt;getCollisionFlags() &amp; btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK){if (index1&amp;1){friction1 = 1.0f;//partId1,index1} else{friction1 = 0.f;}restitution1 = 0.f;}cp.m_combinedFriction = calculateCombinedFriction(friction0,friction1);cp.m_combinedRestitution = calculateCombinedRestitution(restitution0,restitution1);//cp.m_combinedFriction = calculateCombinedFriction(0.0,0.0);//cp.m_combinedRestitution = calculateCombinedRestitution(0.0,0.0);//this return value is currently ignored, but to be on the safe side: return false if you don't calculate frictionreturn true;}</code></pre></div>Does somebody know how to solve this before I report a bug? Thanks.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=10282">Pacha</a> — Mon Apr 14, 2014 2:06 am</p><hr />
]]></content>
	</entry>
	</feed>
