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

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2022-11-22T10:16:02+00:00</updated>

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

		<entry>
		<author><name><![CDATA[Txori]]></name></author>
		<updated>2022-11-22T10:15:49+00:00</updated>

		<published>2022-11-22T10:15:49+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=44170#p44170</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=44170#p44170"/>
		<title type="html"><![CDATA[Re: Collisions not working as intended when setting position/rotation  manually]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=44170#p44170"><![CDATA[
Thanks to Kjell from ZGameEditor forum, this pesky problem is now solved. The problem was coming from the ITERATE_MANIFOLDS_FOR_OBJECT macro in the c++ wrapper. Collisions are now perfect in Omeganaut and I can start messing with rotating objects and physics.<br><br>Maybe I'll make a Pinball game too using ZGameEditor and Bullet3, now that everything is fine!<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=14451">Txori</a> — Tue Nov 22, 2022 10:15 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Txori]]></name></author>
		<updated>2022-10-14T13:26:22+00:00</updated>

		<published>2022-10-14T13:26:22+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=44140#p44140</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=44140#p44140"/>
		<title type="html"><![CDATA[Re: Collisions not working as intended when setting position/rotation  manually]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=44140#p44140"><![CDATA[
Here's the small executable example to illustrate my problem:<ul><li>Move the ball around with the mouse</li><li>Click to switch from simple body shape to compound shape</li></ul><dl class="file"><dt><span class="imageset icon_topic_attach"></span> <a class="postlink" href="https://pybullet.org/Bullet/phpBB3/download/file.php?id=1951">rotating_shape.zip</a></dt></dl><p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=14451">Txori</a> — Fri Oct 14, 2022 1:26 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Txori]]></name></author>
		<updated>2022-11-22T10:16:02+00:00</updated>

		<published>2022-10-14T05:17:23+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=44139#p44139</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=44139#p44139"/>
		<title type="html"><![CDATA[[SOLVED] Collisions not working as intended when setting position/rotation  manually]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=44139#p44139"><![CDATA[
Hello everyone.<br>I'm working on <a href="https://txori.itch.io/omeganaut" class="postlink">a game called Omeganaut</a>, and I decided to use Bullet for collisions because it will involve physics in the future.<br>The engine is <a href="https://www.zgameeditor.org/" class="postlink">ZGameEditor</a> with <a href="https://github.com/Rado-1/ZgeBullet" class="postlink">a wrapper for Bullet Physics Library</a>.<br><br>Until now, everything was fine. The player could fly and collide with buildings and enemies made out of collision boxes and spheres. But recently, I started adding pillars that are not vertical and discovered this problem:<br><br>When the pillar is vertical or horizontal (fig. A), like a lot of the objects in my game, everything's fine.<br>But if it's rotated (fig. B), the ball collides with the box that encompasses the rotated pillar...<br><div class="codebox"><p>Code: </p><pre><code>shape = zbtCreateCylinderShape(0.5, 10);</code></pre></div><div class="inline-attachment"><dl class="file"><dt class="attach-image"><img src="https://pybullet.org/Bullet/phpBB3/download/file.php?id=1950" class="postimage" alt="collision01.png" onclick="viewableArea(this);" /></dt></dl></div>.<br><br>On the contrary, if the shape of the pillar is "complex", the collision works better, but it's not perfect: the ball gets the collision correctly with the pillar, but then it stays collided as long as the ball stays in the red rectangle.<div class="codebox"><p>Code: </p><pre><code>shape = zbtCreateCompoundShape();zbtAddChildShape(shape, zbtCreateCylinderShape(0.5, 10), 0,0,0, 0,0,0);</code></pre></div>...<br><br>I could replace all shapes by compound shapes in my game, but it would be overkill for what it is supposed to do.<br>I made <a href="http://www.emix8.org/forum/viewtopic.php?p=10413#p10413" class="postlink">a working example</a> if you want to try, but here's the general idea:<br>I heavily simplified the code for readability. As you will see, it's quite simple. I use setPosRot to set the physics of the rotating pillar, and the coordinates of the ball. Then I use isColliding to check if both collides.<br><div class="codebox"><p>Code: </p><pre><code>&lt;OnLoaded&gt;// init physical worldxptr World = zbtCreateWorld();zbtSetCurrentWorld(World);// Create modelscreateModel(PillarModel);createModel(BallModel);&lt;/OnLoaded&gt;  &lt;OnUpdate&gt;zbtStepSimulation(App.DeltaTime, 0, 0);&lt;/OnUpdate&gt;  &lt;Model Name="PillarModel"&gt;&lt;Definitions&gt;&lt;Variable Name="PillarBody" Type="xptr"/&gt;&lt;/Definitions&gt;      &lt;OnSpawn&gt;xptr shape = zbtCreateCylinderShape(0.5, 10);PillarBody = zbtCreateRigidBody(1, shape, CurrentModel.Position, CurrentModel.Rotation);&lt;/OnSpawn&gt;      &lt;OnUpdate&gt;// Rotate the pillarCurrentModel.Rotation.Z += 0.001;zbtSetPosRot(PillarBody, CurrentModel.Position, CurrentModel.Rotation);&lt;/OnUpdate&gt;&lt;OnRender&gt;&lt;RenderMesh Mesh="PillarMesh"/&gt;&lt;/OnRender&gt;&lt;/Model&gt;&lt;Model Name="BallModel"&gt;&lt;Definitions&gt;&lt;Variable Name="BallBody" Type="xptr"/&gt;&lt;/Definitions&gt;      &lt;OnSpawn&gt;xptr shape = zbtCreateSphereShape(1.0);BallBody = zbtCreateRigidBody(1, shape, CurrentModel.Position, CurrentModel.Rotation);&lt;/OnSpawn&gt;      &lt;OnUpdate&gt;// Set Ball position to mouse coordinateCurrentModel.Position = vector3(App.MousePosition.X, App.MousePosition.Y, 0);zbtSetPosRot(BallBody, CurrentModel.Position, CurrentModel.Rotation);// Test collision between ball and rotating pillarif (zbtIsColliding(BallBody)) {BallColor.Color = vector3(1, 0, 0); // red} else {BallColor.Color = vector3(1, 1, 1); // white}&lt;/OnUpdate&gt;&lt;OnRender&gt;       &lt;RenderSetColor Name="BallColor" /&gt;&lt;RenderMesh Mesh="BallMesh"/&gt;&lt;/OnRender&gt;&lt;/Model&gt;</code></pre></div>I'm really stuck with this problem. What am I doing wrong ?<br>Thanks for your help.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=14451">Txori</a> — Fri Oct 14, 2022 5:17 am</p><hr />
]]></content>
	</entry>
	</feed>
