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

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2013-12-26T08:20:30+00:00</updated>

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

		<entry>
		<author><name><![CDATA[benfocus55]]></name></author>
		<updated>2013-12-26T08:20:30+00:00</updated>

		<published>2013-12-26T08:20:30+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=32465#p32465</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=32465#p32465"/>
		<title type="html"><![CDATA[Re: How to convert from world coordinate]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=32465#p32465"><![CDATA[
Shogun! Thank you! Saved me countless hours and actually clarified these concepts.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=10627">benfocus55</a> — Thu Dec 26, 2013 8:20 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[shogun22]]></name></author>
		<updated>2013-10-17T09:00:11+00:00</updated>

		<published>2013-10-17T09:00:11+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=31958#p31958</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=31958#p31958"/>
		<title type="html"><![CDATA[Re: How to convert from world coordinate]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=31958#p31958"><![CDATA[
Alright folks,<br><br>after I froze my project for a week I finally found the solution for my coordinate translation problem today. Might be trivial for most of you but for those who are stuck like I was, this is my final function:<br><div class="codebox"><p>Code: </p><pre><code>btVector3 RagdollDemo::pointWorldToLocal(int bodyIndex, btVector3 worldPoint){        return body[bodyIndex]-&gt;getCenterOfMassTransform().inverse()(worldPoint);}</code></pre></div>yes guys it's that easy. Don't know why it took me so long to understand how getCenterOfMassTransform can be used to translate points. Maybe it's not in the manual or I completely overlooked it. Hope this helps someone else.<br><br>Best<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=10478">shogun22</a> — Thu Oct 17, 2013 9:00 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[shogun22]]></name></author>
		<updated>2013-10-02T10:22:24+00:00</updated>

		<published>2013-10-02T10:22:24+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=31875#p31875</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=31875#p31875"/>
		<title type="html"><![CDATA[Re: How to convert from world coordinate]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=31875#p31875"><![CDATA[
I am sorry for reviving this thread but I am completely lost and already wasted countless hours on this simple function.<br>So I know I have to provide the HingeConstraint constructor with local coordinates for axis and anchor point. So I wanted to create two little helper functions to translate a vector from world to local and to translate a point from world to local (since both of them are needed for the axis and the anchor).<br>What I came up with so far is this:<br><div class="codebox"><p>Code: </p><pre><code>btVector3 pointWorldToLocal(int bodyIndex, btVector3 point){btVector3 localPoint;btTransform xform = arrayOfBtRigBodies[bodyIndex]-&gt;getCenterOfMassTransform();// The local coordinates should be [(worldCoords - localOrigin) * inverse(localRotation)] or am I wrong?localPoint = (point - xform.getOrigin()) * xform.getBasis().inverse();return localPoint;}btVector3 axisWorldToLocal(int bodyIndex, btVector3 axis){btTransform xform = arrayOfBtRigBodies[bodyIndex]-&gt;getCenterOfMassTransform();// This works quite well but only if I do not inverse the result of getBasis()... ?btVector3 localAxis = axis * xform.getBasis();return localAxis;}</code></pre></div>Which should be equivalent to c0der's suggestion:<br><blockquote class="uncited"><div>wt1T.transposeOf(arrayOfBtRigBodies[bodyIndex]-&gt;m_matWorldTransform);<br>m_vLocalAnchor1 = (point - arrayOfBtRigBodies[bodyIndex]-&gt;m_vPosition)*wt1T;<br>return m_vLocalAnchor1</div></blockquote>But when I run it, the axis is translated from world to local correctly while pointWorldToLocal produces strange results.<br>I basically wasted two complete days of my life on this so please release me from my pain <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"> <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"><p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=10478">shogun22</a> — Wed Oct 02, 2013 10:22 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[c0der]]></name></author>
		<updated>2013-02-21T04:54:55+00:00</updated>

		<published>2013-02-21T04:54:55+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30062#p30062</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30062#p30062"/>
		<title type="html"><![CDATA[Re: How to convert from world coordinate]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30062#p30062"><![CDATA[
For my hinge joint, I have one anchor given in world coords and a world hinge axis.<br><br>From the world anchor, you build two local anchors as follows for each body<br><div class="codebox"><p>Code: </p><pre><code>wt1T.transposeOf(m_pRigidBody1-&gt;m_matWorldTransform);wt2T.transposeOf(m_pRigidBody2-&gt;m_matWorldTransform);m_vLocalAnchor1 = (vAnchor - m_pRigidBody1-&gt;m_vPosition)*wt1T;m_vLocalAnchor2 = (vAnchor - m_pRigidBody2-&gt;m_vPosition)*wt2T;</code></pre></div>Basically these are vectors ra and rb (of the relative position) in local coords of each body. Perhaps you can paste some code or show your approach<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=9431">c0der</a> — Thu Feb 21, 2013 4:54 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[henokyen]]></name></author>
		<updated>2013-02-21T04:20:29+00:00</updated>

		<published>2013-02-21T04:20:29+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30061#p30061</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30061#p30061"/>
		<title type="html"><![CDATA[Re: How to convert from world coordinate]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30061#p30061"><![CDATA[
Thanks ,<br>basically i want to create a joint between two legs for my robot.<br>and i am using the hinge constraint. and this class requires the local coordinates of the legs to be joined. <br>I do not know who to get the local coordinated now.<br>can just provide a piece of codes that do this ?<br>thank<br>you<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=9947">henokyen</a> — Thu Feb 21, 2013 4:20 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[c0der]]></name></author>
		<updated>2013-02-21T01:39:18+00:00</updated>

		<published>2013-02-21T01:39:18+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30059#p30059</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30059#p30059"/>
		<title type="html"><![CDATA[Re: How to convert from world coordinate]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30059#p30059"><![CDATA[
Converting from world to local just involves multiplying the world transform matrix of the object by the inverse to get the identity matrix. <br><br>Normally you want to transform a different object B into the local frame of object A, which just involves multiplying B's world transform matrix by A's inverse world transform matrix, meaning that A will now be at the origin and B's position will be relative to this origin<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=9431">c0der</a> — Thu Feb 21, 2013 1:39 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[henokyen]]></name></author>
		<updated>2013-02-20T06:18:53+00:00</updated>

		<published>2013-02-20T06:18:53+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30049#p30049</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30049#p30049"/>
		<title type="html"><![CDATA[How to convert from world coordinate]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=30049#p30049"><![CDATA[
I have some objects in the physics simulation and i want to know the local coordinates of these objects ?<br>How can i do that ?<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=9947">henokyen</a> — Wed Feb 20, 2013 6:18 am</p><hr />
]]></content>
	</entry>
	</feed>
