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

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2020-07-03T05:27:42+00:00</updated>

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

		<entry>
		<author><name><![CDATA[water]]></name></author>
		<updated>2020-07-03T05:27:42+00:00</updated>

		<published>2020-07-03T05:27:42+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43011#p43011</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43011#p43011"/>
		<title type="html"><![CDATA[How to improve the rotation speed of rigid body]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43011#p43011"><![CDATA[
I set up a rigid body with a mass of 0 and change its rotation by changing the Euler angle<div class="codebox"><p>Code: </p><pre><code>btCollisionShape* groundShape = new btBvhTriangleMeshShape(tMesh, useQuantization);         btTransform groundTransformgroundTransform.setIdentity();groundTransform.setOrigin(btVector3(0, 0, 0));compound-&gt;addChildShape(groundTransform, groundShape);btQuaternion quaternion = btQuaternion(m_yaw * RADIANS_PER_DEGREE, m_pich * RADIANS_PER_DEGREE, m_roll* RADIANS_PER_DEGREE);groundTransform.setRotation(quaternion);btScalar mass(0);</code></pre></div><div class="codebox"><p>Code: </p><pre><code>for (int j = mp_btDynamicsWorld-&gt;getNumCollisionObjects() - 1; j &gt;= 0; j--){int m = 1;btCollisionObject* obj = mp_btDynamicsWorld-&gt;getCollisionObjectArray()[j];btRigidBody* body = btRigidBody::upcast(obj);body-&gt;getCenterOfMassPosition();btQuaternion qua = body-&gt;getOrientation();btVector3 angul(1, 1, 1);btTransform trans;btMatrix3x3 matrix33 = trans.getBasis();btVector3 angularVelocity(0, 0, 0);trans.setIdentity();btQuaternion quaternion = btQuaternion(m_yaw * RADIANS_PER_DEGREE, m_pich * RADIANS_PER_DEGREE, m_roll* RADIANS_PER_DEGREE);if (body &amp;&amp; body-&gt;getMotionState()){body-&gt;getMotionState()-&gt;getWorldTransform(trans);}else{trans = obj-&gt;getWorldTransform();}m_trajectory[m_tra++].setValue(float(trans.getOrigin().getX()), float(trans.getOrigin().getY()), float(trans.getOrigin().getZ()));if (j == mp_btDynamicsWorld-&gt;getNumCollisionObjects() - 1){trans.setRotation(quaternion);body-&gt;setCenterOfMassTransform(trans);glPushMatrix();glRotatef(m_yaw, 0.0, 1.0, 0.0);glRotatef(m_pich, 1.0, 0.0, 0.0);glRotatef(m_roll, 0.0, 0.0, 1.0);DrawMesh();glPopMatrix();}</code></pre></div><div class="codebox"><p>Code: </p><pre><code>switch (event-&gt;key()){case Qt::Key_Escape:                             close();update();break;case Qt::Key_PageUp:                              m_yaw -= 0.2f;update();break;</code></pre></div><br>The rotation angle can be increased through keyboard events. I hope the rigid body can rotate faster. In addition to increasing the degree of yaw, what else can I do? Thank you very much.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=13653">water</a> — Fri Jul 03, 2020 5:27 am</p><hr />
]]></content>
	</entry>
	</feed>
