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

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2021-11-09T16:40:08+00:00</updated>

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

		<entry>
		<author><name><![CDATA[drleviathan]]></name></author>
		<updated>2021-11-09T16:40:08+00:00</updated>

		<published>2021-11-09T16:40:08+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43692#p43692</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43692#p43692"/>
		<title type="html"><![CDATA[Re: Can't get rotation from applyForce's rel_pos]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43692#p43692"><![CDATA[
I would expect the object to rotate after your <strong class="text-strong">applyForce()</strong> call.  However, <strong class="text-strong">applyForce()</strong> only lasts for one substep so if you don't call it multiple times over several substeps it is possible your body won't pick up enough angular velocity to notice.  The delta angular velocity from a single <strong class="text-strong">applyForce()</strong> with offset not only depends on the offset and strength of force, but also on the length of the substep and the angular inertia tensor of the object.  Short substeps and large angular inertia tensor coefficients make for very sluggish objects after one poke with <strong class="text-strong">applyForce()</strong>.<br><br>If you're trying to make a fun game, and don't want to tear your hair out tuning forces and offsets, then I would recommend NOT using <strong class="text-strong">applyForce()</strong> if you can help it and instead compute the angular velocity you want and slew the body's angular velocity toward your desired value.  Something like this (in pseudocode):<div class="codebox"><p>Code: </p><pre><code>old_angular_velocity = body-&gt;getAngularVelocity();delta = substep_duration / SLEW_PERIOD;delta_angular_velocity = delta * (new_target_angular_velocity - old_angular_velocity);if (delta_angular_velocity.length() &gt; MIN_DELTA_ANGULAR_VELOCITY) {    new_angular_velocity =  old_angular_velocity + delta_angular_velocity;    body-&gt;setAngularVelocity(new_angular_velocity);}</code></pre></div>You then have a single value to tune: <strong class="text-strong">SLEW_PERIOD</strong>.  It should be about 1/3 the time you would like it to take for your object to transition from current value to new value.  So, if you want your object to transition in about 1 second you would set <strong class="text-strong">SLEW_PERIOD</strong> to be about 0.333.  The reason for the <strong class="text-strong">MIN_DELTA_ANGULAR_VELOCITY</strong> is to prevent the logic above from keeping the body active when it doesn't need to be adjusted.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=11033">drleviathan</a> — Tue Nov 09, 2021 4:40 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zb10948]]></name></author>
		<updated>2021-11-07T17:47:02+00:00</updated>

		<published>2021-11-07T17:47:02+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43688#p43688</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43688#p43688"/>
		<title type="html"><![CDATA[Can't get rotation from applyForce's rel_pos]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43688#p43688"><![CDATA[
Hello,<br><br>I'm unable to achieve 'natural' rotation of a rigidbody by modifiying the position from centre of mass to offseted.<br><div class="codebox"><p>Code: </p><pre><code>    btVector3 force(-1, 0, 0);                    force *= 13.0f;                    btVector3 thrust_position(0, 1.7, 0);                    btVector3 com = body-&gt;getCenterOfMassPosition();                    thrust_position += com;                    body-&gt;applyForce(force, thrust_position);</code></pre></div>Effect of this code is the same as running applyCentralForce(force). The getRotation() quaternion remains at (1, 0, 0, 0);<br><br>The body is rigidbody dynamic with a mass of 1 in world with no gravity, compound shape made of a few convex hulls. It rotates normally via manual transformation. <br><br>Am I doing this wrong and should I supply a world coordinate that matches some point on the hull itself? My goal is similar to aircraft thrust vectoring, by offsetting the thrust point from the centre.<br><br>Thanks for tips in advance <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=14092">zb10948</a> — Sun Nov 07, 2021 5:47 pm</p><hr />
]]></content>
	</entry>
	</feed>
