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

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2013-11-17T17:32:54+00:00</updated>

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

		<entry>
		<author><name><![CDATA[b0gd4n]]></name></author>
		<updated>2013-11-17T17:32:54+00:00</updated>

		<published>2013-11-17T17:32:54+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=32182#p32182</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=32182#p32182"/>
		<title type="html"><![CDATA[get btCollisionShape current transform]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=32182#p32182"><![CDATA[
Hey guys,<br><br>I have made a compound shape <div class="codebox"><p>Code: </p><pre><code>compound = new btCompoundShape();</code></pre></div>Then I have a collision shape added to the compound:<br><div class="codebox"><p>Code: </p><pre><code>btCollisionShape* turretShape = new btBoxShape(btVector3(0.4f, 0.2f, 1.2f));btTransform turretTrans;turretTrans.setIdentity();turretTrans.setOrigin(btVector3(0.0f, 2.2f, 0.0f));compound-&gt;addChildShape(turretTrans, turretShape);</code></pre></div>The compund shape is then transformed into a rigid body and then added to a vehicle raycaster as a chassis:<br><div class="codebox"><p>Code: </p><pre><code>m_carChassis = CreateRigidBody(2000, tr, compound);m_vehicle = new btRaycastVehicle(m_tuning, m_carChassis, m_vehicleRayCaster);</code></pre></div><br><br>The vehicle is moving along, together with it's wheels, chassis and turret, but I cannot seem to get hold of the updated turret transform.<br>Whenever I try something like this:<br><div class="codebox"><p>Code: </p><pre><code>compound-&gt;getChildTransform(1).getOpenGLMatrix(mturret);</code></pre></div>I always get the initial position of the turret, where it was first created.<br><br>Now, for the wheels I can do this: <div class="codebox"><p>Code: </p><pre><code>m_vehicle-&gt;getWheelInfo(i).m_worldTransform.getOpenGLMatrix(mwheel);</code></pre></div>And for the chassis I can do this:<div class="codebox"><p>Code: </p><pre><code>m_vehicle-&gt;getChassisWorldTransform().getOpenGLMatrix(mchassis);</code></pre></div>But I don't know how do I get hold of that turret collision shape updated transform?<br><br>Please note that where I need this information I have access to both the compound and the turretShape (the actual btCollisionShape).<br><br>EDIT:<br><br>I found the answer. Here's what I did:<br><div class="codebox"><p>Code: </p><pre><code>btTransform chassisMatrix = m_vehicle-&gt;getChassisWorldTransform();btTransform turretMatrix = compound-&gt;getChildTransform(1);turretMatrix *= chassisMatrix;turretMatrix.getOpenGLMatrix(mturret);</code></pre></div><p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=10543">b0gd4n</a> — Sun Nov 17, 2013 5:32 pm</p><hr />
]]></content>
	</entry>
	</feed>
