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

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2013-12-04T14:38:45+00:00</updated>

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

		<entry>
		<author><name><![CDATA[Nyx Erebos]]></name></author>
		<updated>2013-12-04T14:38:45+00:00</updated>

		<published>2013-12-04T14:38:45+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=32322#p32322</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=32322#p32322"/>
		<title type="html"><![CDATA[Controlling a rigid body from user input]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=32322#p32322"><![CDATA[
I'm trying to rotate a rigid from the mouse movement (I'm using bullet 2.81 and irrlicht 1.8 ) but I have a problem figuring out how to do it :<br><div class="codebox"><p>Code: </p><pre><code>//mousePosition is the relative position of the mouse, (0,0) is the upper left corner and (1,1) the lower right corner//left/right rotation, I substract 0.5 to get a number between -0.5 and 0.5float rotationOverY = mousePosition.X - 0.5;//up/down rotationfloat rotationOverX = mousePosition.Y - 0.5;btVector3 angularVelocity = btVector3(rotationOverX,rotationOverY,0);myRigidBody-&gt;setAngularVelocity(angularVelocity*100);//the velocity is set back to (0,0,0) when the mouse stop moving</code></pre></div>When I try to rotate only over x or only over y it works fine but when I move the mouse randomly it doesn't work anymore. Namely if I rotate 90° (or -90°) over y (so right/left) and then try to rotate over x (so up/down) the body rotates on itself over z. Another weird behaviour is when the body rotates 180°  over y (looking back), up and down are inverted. Looks like a local/world rotation problem so I guess that I don't understand how to use setAngularVelocity. If someone can tell me what I'm doing wrong it would help me  <img class="smilies" src="https://pybullet.org/Bullet/phpBB3/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=10440">Nyx Erebos</a> — Wed Dec 04, 2013 2:38 pm</p><hr />
]]></content>
	</entry>
	</feed>
