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

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2011-08-24T12:03:36+00:00</updated>

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

		<entry>
		<author><name><![CDATA[dan]]></name></author>
		<updated>2011-08-24T12:03:36+00:00</updated>

		<published>2011-08-24T12:03:36+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25078#p25078</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25078#p25078"/>
		<title type="html"><![CDATA[Re: Question: custom btMotionState and serializing objects]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25078#p25078"><![CDATA[
I have created a simple loop to iterate over all of the objects in the btDiscreteDynamicsWorld after I step the worl and use the btDefaultMotionState. Here is what I do:<div class="codebox"><p>Code: </p><pre><code>dynamicsWorld-&gt;stepSimulation(1/60.f,10);for (int i=dynamicsWorld-&gt;getNumCollisionObjects()-1; i&gt;=0 ;i--){btCollisionObject* obj = dynamicsWorld-&gt;getCollisionObjectArray()[i];btRigidBody* body = btRigidBody::upcast(obj);if (body &amp;&amp; body-&gt;isActive() &amp;&amp; body-&gt;getMotionState()){btTransform trans;body-&gt;getMotionState()-&gt;getWorldTransform(trans);btVector3 velocity = body-&gt;getLinearVelocity();std::cout&lt;&lt;"vy: "&lt;&lt; velocity.getY()&lt;&lt;std::endl;}}</code></pre></div>Is this the best way to iterate over all of the <em class="text-italics">active</em> objects in the dynamicWorld? Also does this mean that I am ultimately iterating over all of the objects twice to see if they are active because the btMotionState checks for active objects and then I check for them?<br><br>Thanks for your time,<br>Dan<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=8686">dan</a> — Wed Aug 24, 2011 12:03 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[dan]]></name></author>
		<updated>2011-08-23T21:07:47+00:00</updated>

		<published>2011-08-23T21:07:47+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25056#p25056</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25056#p25056"/>
		<title type="html"><![CDATA[Question: custom btMotionState and serializing objects]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=25056#p25056"><![CDATA[
I am currently using a custom btMotionState to get the location and rotation data of an object when it has moved. I was wondering if there is any way to utilize btMotionState to also retrieve other properties such as velocities so I can ultimately serialize the objects to a database once they have been updated. If this is not possible, should I iterate through all of the btDiscreteDynamicsWorld objects and see which active objects have moved?<br><br>I am hoping that I can use the btMotionState because it was so easy to setup, but I don't think that is a possiblility....<br><br>Thanks so much for your time,<br>Dan<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=8686">dan</a> — Tue Aug 23, 2011 9:07 pm</p><hr />
]]></content>
	</entry>
	</feed>
