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

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2015-04-24T14:49:41+00:00</updated>

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

		<entry>
		<author><name><![CDATA[drleviathan]]></name></author>
		<updated>2015-04-24T14:49:41+00:00</updated>

		<published>2015-04-24T14:49:41+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=35326#p35326</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=35326#p35326"/>
		<title type="html"><![CDATA[Re: How can I rotate an object's velocity?]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=35326#p35326"><![CDATA[
I believe it is safe to change the velocity of an object directly, despite its collisions.  Within reason, of course -- setting the velocity very high or pushing the object deeper into penetration can only cause problems.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=11033">drleviathan</a> — Fri Apr 24, 2015 2:49 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[joehot200]]></name></author>
		<updated>2015-04-24T13:52:45+00:00</updated>

		<published>2015-04-24T13:52:45+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=35325#p35325</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=35325#p35325"/>
		<title type="html"><![CDATA[Re: How can I rotate an object's velocity?]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=35325#p35325"><![CDATA[
<blockquote class="uncited"><div>Directly setting the velocity <strong class="text-strong">IS</strong> how you change it.  I don't see how that "overwrites the collision" as you put it.<br><br>If you want to constantly reorient the velocity according to the direction of the ship I would suggest implementing an Action that does just that and then give the action to the btDiscreteDynamicsWorld (which I assume you're using).  Research btActionInterface and how it is used (Huh, I notice there is no simple Action Demo available.)<br><br>It is possible to gradually reorient the velocity to match the target velocity rather than setting it suddenly.   Perhaps this wouldn't "overwrite the collision" so bad (whatever that means).  Here is some example code for how to do it:<div class="codebox"><p>Code: </p><pre><code>const btScalar adjustmentTimescale = 0.5; // seconds for velocity to get within 1/e of its targetVelocitybtVector3 velocityAdjustment = velocityWeWant - currentVelocity;btScalar adjustmentFactor = btMin(1.0, timeStep / adjustmentTimescale);// blend current and target velocitiesbtVector3 newVelocity = btScalar(1.0 - adjustmentFactor) * currentVelocity + adjustmentFactor * targetVelocity;body-&gt;setLinearVelocity(newVelocity);</code></pre></div>The nice thing is that you can tweak the strength of your blending by adjusting the adjustmentTimescale.  Shorter timescales make the transition faster.  The btMin is there for stability in case you accidentally provide too small of a timescale, or too large of a timeStep.</div></blockquote>I thought that using setLinearVelocity() removes velocities from collisions? Or am I wrong?<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=10857">joehot200</a> — Fri Apr 24, 2015 1:52 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[drleviathan]]></name></author>
		<updated>2015-04-23T15:52:11+00:00</updated>

		<published>2015-04-23T15:52:11+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=35317#p35317</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=35317#p35317"/>
		<title type="html"><![CDATA[Re: How can I rotate an object's velocity?]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=35317#p35317"><![CDATA[
Directly setting the velocity <strong class="text-strong">IS</strong> how you change it.  I don't see how that "overwrites the collision" as you put it.<br><br>If you want to constantly reorient the velocity according to the direction of the ship I would suggest implementing an Action that does just that and then give the action to the btDiscreteDynamicsWorld (which I assume you're using).  Research btActionInterface and how it is used (Huh, I notice there is no simple Action Demo available.)<br><br>It is possible to gradually reorient the velocity to match the target velocity rather than setting it suddenly.   Perhaps this wouldn't "overwrite the collision" so bad (whatever that means).  Here is some example code for how to do it:<div class="codebox"><p>Code: </p><pre><code>const btScalar adjustmentTimescale = 0.5; // seconds for velocity to get within 1/e of its targetVelocitybtVector3 velocityAdjustment = velocityWeWant - currentVelocity;btScalar adjustmentFactor = btMin(1.0, timeStep / adjustmentTimescale);// blend current and target velocitiesbtVector3 newVelocity = btScalar(1.0 - adjustmentFactor) * currentVelocity + adjustmentFactor * targetVelocity;body-&gt;setLinearVelocity(newVelocity);</code></pre></div>The nice thing is that you can tweak the strength of your blending by adjusting the adjustmentTimescale.  Shorter timescales make the transition faster.  The btMin is there for stability in case you accidentally provide too small of a timescale, or too large of a timeStep.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=11033">drleviathan</a> — Thu Apr 23, 2015 3:52 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[joehot200]]></name></author>
		<updated>2015-04-21T09:50:24+00:00</updated>

		<published>2015-04-21T09:50:24+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=35314#p35314</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=35314#p35314"/>
		<title type="html"><![CDATA[How can I rotate an object's velocity?]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=35314#p35314"><![CDATA[
I would have put a more descriptive title, but the title space is a bit small.<br><br>I am developing a ship fighting game, and I would like to move my ship (a RigidBody) around. This works - However, when my ship changes rotation, the RigidBody simply keeps the velocity.<br><br>If this, say, is the original velocity, then...<br><img src="http://i.gyazo.com/9b4764cf000253f1f912fbe9be36363c.png" class="postimage" alt="Image"><br>the ship would keep that velocity, even when I rotated my ship.<br><img src="http://i.gyazo.com/fc4cba225e52f386c694a10709951221.png" class="postimage" alt="Image"><br><br>I would like the ship to have the same velocity, but in a new direction. Like this:<br><img src="http://i.gyazo.com/436a1fc467a9241d6504918fb73a6b49.png" class="postimage" alt="Image"><br><br>How can I do that, without directly setting the velocity (setting the velocity overwrites the collision, and the ship will be rotating almost all the time)?<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=10857">joehot200</a> — Tue Apr 21, 2015 9:50 am</p><hr />
]]></content>
	</entry>
	</feed>
