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

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2021-05-15T15:41:04+00:00</updated>

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

		<entry>
		<author><name><![CDATA[drleviathan]]></name></author>
		<updated>2021-05-15T15:41:04+00:00</updated>

		<published>2021-05-15T15:41:04+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43430#p43430</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43430#p43430"/>
		<title type="html"><![CDATA[Re: Manual collision response for kinematic objects]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43430#p43430"><![CDATA[
Yeah... as I recall the <strong class="text-strong">btKinematicCharacterController</strong> has some bugs or shortcomings, but maybe it will work for your case and if not it could provide a good starting point or example.  In particular it demonstrates how to sweep forward to find first touch.<br><br>Some things to worry about, depending on the game content: can the controller get "stuck" in a tight spot (e.g. when floor and roof squeeze together)?  Does it "fall" correctly when walking off an edge? etc.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=11033">drleviathan</a> — Sat May 15, 2021 3:41 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Karoon2]]></name></author>
		<updated>2021-05-14T17:14:47+00:00</updated>

		<published>2021-05-14T17:14:47+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43429#p43429</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43429#p43429"/>
		<title type="html"><![CDATA[Re: Manual collision response for kinematic objects]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43429#p43429"><![CDATA[
Thank you very much for your quick reply! I will try that class. I thought using this controller was discouraged (at least I read something like that in several threads). <br>Maybe this will do. Thanks again!<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=13971">Karoon2</a> — Fri May 14, 2021 5:14 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[drleviathan]]></name></author>
		<updated>2021-05-13T03:48:42+00:00</updated>

		<published>2021-05-13T03:48:42+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43427#p43427</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43427#p43427"/>
		<title type="html"><![CDATA[Re: Manual collision response for kinematic objects]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43427#p43427"><![CDATA[
The way to do this is to "sweep" the kinematic object from <strong class="text-strong">oldTransform</strong> to <strong class="text-strong">newTransform</strong> and to stop at first hit, else teleport to <strong class="text-strong">newTransform</strong>.  This is how the <strong class="text-strong">btKinematicCharacterController</strong> works, as I recall, although it does a series of sweeps each frame so that it can walk up and down slopes and small steps.  Perhaps you could fork <strong class="text-strong">btKinematicCharacterController</strong> to make <strong class="text-strong">MyKinematicCharacterController</strong> and then tweak its behavior to suit your needs.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=11033">drleviathan</a> — Thu May 13, 2021 3:48 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Karoon2]]></name></author>
		<updated>2021-05-12T12:58:39+00:00</updated>

		<published>2021-05-12T12:58:39+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43426#p43426</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43426#p43426"/>
		<title type="html"><![CDATA[Manual collision response for kinematic objects]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43426#p43426"><![CDATA[
Hey guys, I just started using bullet (BulletSharp for C#) and I really like it! The automatic collisions response is awesome. But now, I want to add some custom character behaviour and need your help:<br><br>I have a kinematic character object (box shape) that gets created with the following settings:<div class="codebox"><p>Code: </p><pre><code>// ..._rigidBody.ActivationState = ActivationState.ActiveTag | ActivationState.DisableDeactivation;_rigidBody.CollisionFlags = CollisionFlags.CharacterObject | CollisionFlags.KinematicObject;// create ghost object for it:_ghostObject = new GhostObject();_ghostObject.CollisionShape = _rigidBody.CollisionShape;_ghostObject.WorldTransform = _rigidBody.WorldTransform;</code></pre></div>I then add both the _rigidBody and the _ghostObject to my current world.<br><br>I move my object around with this method:<div class="codebox"><p>Code: </p><pre><code>public void MoveKinematic(float x, float y, float z){BulletSharp.Math.Matrix newTransform = _rigidBody.MotionState.WorldTransform;newTransform.Origin += new BulletSharp.Math.Vector3(x, y, z);_rigidBody.MotionState.WorldTransform = newTransform;// update the ghost's position as well:if (HasGhostObject)_ghostObject.WorldTransform = newTransform;}</code></pre></div><strong class="text-strong">My problem now is this:</strong><br>I use the ghost object to detect collisions with other objects:<div class="codebox"><p>Code: </p><pre><code>// the ghost always collides with the kinematic object//(since they share the same shape and world transform).// thus, count must be &gt; 1 whenever the ghost collides with an object other than the player object:if (_ghostObject.OverlappingPairs.Count &gt; 1){AlignedCollisionObjectArray collisions = GetGhostObject().OverlappingPairs;foreach(CollisionObject b in collisions){b.Activate(true);// TODO: Undo the collision by moving the player object back by a bit}}</code></pre></div>This kind of works but my kinematic object does not stop when it hits a different object. It kind of moves slightly into it (before the colliding object responds to my kinematic player object).<br>What I would like my kinematic player object to behave like is:<ul><li>Check for collisions (ok, works)</li></ul><ul><li>Check by how much it is "inside" another object (minimum translation vector in order to undo the collision)</li></ul><ul><li>Move itself out of the colliding object</li></ul><em class="text-italics">Is that possible and is my approach even viable?</em> Any help would be hugely appreciated! Thanks in advance!<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=13971">Karoon2</a> — Wed May 12, 2021 12:58 pm</p><hr />
]]></content>
	</entry>
	</feed>
