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

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2020-11-08T15:07:34+00:00</updated>

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

		<entry>
		<author><name><![CDATA[arsakes]]></name></author>
		<updated>2020-11-08T15:07:34+00:00</updated>

		<published>2020-11-08T15:07:34+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43180#p43180</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43180#p43180"/>
		<title type="html"><![CDATA[Create btIndexMesh from WavefronObj]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43180#p43180"><![CDATA[
Hello,<br><br>I try to set fields in `btIndexMesh` in order to use geometry that I've read from OBJ file using `tinyObjLoader` lib.<br>I'm creating the btIndexMesh in a following way.<div class="codebox"><p>Code: </p><pre><code>btIndexedMesh indexed_mesh = btIndexedMesh();        indexed_mesh.m_numTriangles = vertex_count / 3;                      indexed_mesh.m_triangleIndexBase = (const unsigned char*) &amp;shapes[s].mesh.indices[0].vertex_index;                                                                            indexed_mesh.m_triangleIndexStride = 3 * sizeof(tinyobj::index_t);            indexed_mesh.m_numVertices = vertex_count;            indexed_mesh.m_vertexBase = (const unsigned char*) &amp;(attrib.vertices[0]);            indexed_mesh.m_vertexStride = 3 * sizeof(float);                                 </code></pre></div> <br><br>As for atrrib and mesh.indices goes:<ul><li>shapes[0].mesh.indices is of type std::vector&lt;tinyobj::index_t&gt; and contains indices of vertices that form triangles (a map from to attrib).</li><li> attrib.vertices is of type std::vector&lt;float&gt;) and contains all the coordintes of vertices</li></ul>They are a result of executing  `tinyobj::LoadObj` on the *.obj <br><br>Here you have the code of the OBJ loader (it's also used in bullet examples).<br><a href="https://github.com/bulletphysics/bullet3/blob/75df77611aaa3151ac857c7d8da97bae6bcc8261/examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.h" class="postlink">https://github.com/bulletphysics/bullet ... j_loader.h</a><br><br><br><br>So, the code doesn't seem to be right, because I get differnt mesh than using using btTriangleMesh class.<br>Can some tell me what I'm doing wrong?<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=13821">arsakes</a> — Sun Nov 08, 2020 3:07 pm</p><hr />
]]></content>
	</entry>
	</feed>
