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

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2021-07-18T12:12:43+00:00</updated>

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

		<entry>
		<author><name><![CDATA[kcjsend2]]></name></author>
		<updated>2021-07-18T12:12:43+00:00</updated>

		<published>2021-07-18T12:12:43+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43497#p43497</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43497#p43497"/>
		<title type="html"><![CDATA[Re: How can I control Throttle and Steering of Hinge2Vehicle?]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43497#p43497"><![CDATA[
I fixed it! it was just little mistake. here's fixed code : <div class="codebox"><p>Code: </p><pre><code>void CVehiclePlayer::Update(float fTimeElapsed, btDiscreteDynamicsWorld* pbtDynamicsWorld, DWORD dwBehave){switch (dwBehave){case DIR_LEFT:{m_gVehicleSteering += m_steeringIncrement * fTimeElapsed;if (m_gVehicleSteering &gt; m_steeringClamp)m_gVehicleSteering = m_steeringClamp;for (int i = 0; i &lt; 2; ++i){m_pWheel[i]-&gt;getHinge()-&gt;setTargetVelocity(5, m_gVehicleSteering);}break;}case DIR_RIGHT:{m_gVehicleSteering -= m_steeringIncrement * fTimeElapsed;if (m_gVehicleSteering &lt; -m_steeringClamp)m_gVehicleSteering = -m_steeringClamp;for (int i = 0; i &lt; 2; ++i){m_pWheel[i]-&gt;getHinge()-&gt;setTargetVelocity(5, m_gVehicleSteering);}break;}case DIR_FORWARD:{m_gEngineForce += m_EngineForceIncrement * fTimeElapsed;m_gBreakingForce = 0.f;for (int i = 0; i &lt; 2; ++i){m_pWheel[i]-&gt;getHinge()-&gt;setTargetVelocity(3, m_gEngineForce);}break;}case DIR_BACKWARD:{m_gEngineForce -= m_EngineForceIncrement * fTimeElapsed;m_gBreakingForce = 0.f;for (int i = 0; i &lt; 2; ++i){m_pWheel[i]-&gt;getHinge()-&gt;setTargetVelocity(3, m_gEngineForce);}break;}}}</code></pre></div><p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=14021">kcjsend2</a> — Sun Jul 18, 2021 12:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[kcjsend2]]></name></author>
		<updated>2021-07-18T04:42:28+00:00</updated>

		<published>2021-07-18T04:42:28+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43496#p43496</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43496#p43496"/>
		<title type="html"><![CDATA[How can I control Throttle and Steering of Hinge2Vehicle?]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43496#p43496"><![CDATA[
first, sorry for bad english<br><br>I follow some example about Hinge2Vehicle, than I realized that Hinge2Vehicle doesn't have any Control of Throttle<br>So I  guess that pHinge2-&gt;setTargetVelocity is might be solution of this, and this is result<br><div class="codebox"><p>Code: </p><pre><code>switch (dwBehave){case DIR_LEFT:{m_gVehicleSteering += m_steeringIncrement;if (m_gVehicleSteering &gt; m_steeringClamp)m_gVehicleSteering = m_steeringClamp;for (int i = 0; i &lt; 2; ++i){m_pWheel[i]-&gt;getHinge()-&gt;setTargetVelocity(5, m_gVehicleSteering);}break;}case DIR_RIGHT:{m_gVehicleSteering -= m_steeringIncrement;if (m_gVehicleSteering &lt; -m_steeringClamp)m_gVehicleSteering = -m_steeringClamp;for (int i = 0; i &lt; 2; ++i){m_pWheel[i]-&gt;getHinge()-&gt;setTargetVelocity(5, m_gVehicleSteering);}break;}case DIR_FORWARD:{m_gEngineForce = m_maxEngineForce;m_gBreakingForce = 0.f;for (int i = 0; i &lt; 2; ++i){m_pWheel[i]-&gt;getHinge()-&gt;setTargetVelocity(3, m_gEngineForce);}break;}case DIR_BACKWARD:{m_gEngineForce = -m_maxEngineForce;m_gBreakingForce = 0.f;for (int i = 0; i &lt; 2; ++i){m_pWheel[i]-&gt;getHinge()-&gt;setTargetVelocity(3, m_gEngineForce);}break;}}</code></pre></div>but result is very wrong - wheels are not rotates it self, but it revolution with pBodyA - chassis of the car<br>how can i fix this? i can't find what is wrong<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=14021">kcjsend2</a> — Sun Jul 18, 2021 4:42 am</p><hr />
]]></content>
	</entry>
	</feed>
