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

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2015-08-25T02:09:42+00:00</updated>

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

		<entry>
		<author><name><![CDATA[macina11]]></name></author>
		<updated>2015-08-25T02:09:42+00:00</updated>

		<published>2015-08-25T02:09:42+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=36131#p36131</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=36131#p36131"/>
		<title type="html"><![CDATA[Re: Rendering a snapshot of a Dynamica Rigid Body Array in M]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=36131#p36131"><![CDATA[
Enter your message here, it may contain no more than 60000 characters. <br><strong class="text-strong"><a href="http://www.detectorall.com/categories/X%252dray-Screening-Systems/" class="postlink">backscatter x-ray scanners</a></strong><p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=11453">macina11</a> — Tue Aug 25, 2015 2:09 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[metaldev]]></name></author>
		<updated>2014-02-17T18:12:39+00:00</updated>

		<published>2014-02-17T18:12:39+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=32986#p32986</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=32986#p32986"/>
		<title type="html"><![CDATA[Rendering a snapshot of a Dynamica Rigid Body Array in Maya]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=32986#p32986"><![CDATA[
I was beating my face against my desk trying to get a Dynamica Rigid Body Array to render in Maya.  Beautiful simulation!  But useless if I couldn't render or bake them.<br><br>So I wrote the following MEL script that instances and places a set of objects at the positions of the bodies in the rigid body array so you can render or export or do whatever with them.<br><br>It does not handle any animation.<br>It's simply for using a rigid body array to place objects in a scene.<br><br>Hopefully it will be useful to someone else too,<br>enjoy:<br><br><div class="codebox"><p>Code: </p><pre><code>//This tool instances and places a set of ordered object(s) at the positions of the bodies in a Dynamica rigid body array//first select the rigid body array SHAPE,  then select objects that you want instanced at the positions of the bodies //in the rigid body arrayglobal proc string[] bakeRigidBodyArraySnapshot(){         string $sel[] = `ls -sl`;        if (`objectType $sel[0]` != "dRigidBodyArray")        error "The Dynamica rigid body array SHAPE must be selected first.";        int $bodyCount = `getAttr ( $sel[0] + ".numBodies")`;    int $variantCount = `size $sel`;            if ($variantCount &lt; 2)        error "Select the rigid body SHAPE first,  then select geometry variants that you want instanced at the positions of the rigid bodies.";        int $i = 1; //skip the rigid body itself    for (; $i &lt; $variantCount; $i++)    {        if (`objectType $sel[$i]` != "transform")        {            string $shapeList[] = `listRelatives -path -s $sel[$i]`;            for($shape in $shapeList)            {            if ( `nodeType $shape` != "mesh" &amp;&amp; `nodeType $shape` != "surface")                        error "Select the rigid body SHAPE first,  then select geometry variants. The objects that followed were not detected to be geometry.";                                        }        }    }        string $newObjects[];        int $currentVariant = 1;        for ($i = 0; $i &lt; $bodyCount; $i++)    {                string $newObj[] = `instance $sel[$currentVariant]`;        float $t[] = `getAttr ($sel[0] + ".position[" + $i + "]")`;        float $r[] = `getAttr ($sel[0] + ".rotation[" + $i + "]")`;        move -absolute $t[0] $t[1] $t[2] $newObj[0];        rotate -absolute  $r[0] $r[1] $r[2] $newObj[0];                      $newObjects[`size $newObjects`] = $newObj[0];                $currentVariant ++;        if ($currentVariant &gt;= $variantCount)            $currentVariant = 1; // 0 is the rigidBodyArray    }         return $newObjects;   }select `bakeRigidBodyArraySnapshot`;</code></pre></div><p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=10727">metaldev</a> — Mon Feb 17, 2014 6:12 pm</p><hr />
]]></content>
	</entry>
	</feed>
