• Advertisement

erwincoumans

Member
  • Content count

    110
  • Joined

  • Last visited

Community Reputation

281 Neutral

About erwincoumans

  • Rank
    Member
  1. Motor control redux

      I've been barely visiting Bullet forums, because I have been working on control for robotics and articulated characters for a few years now, and now getting involved with deep learning in this context (I work in the Google Brain team nowadays where we create/use TensorFlow). I just replied: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?p=37890#p37890   I'm going to add some more motor control and deep learning demos in Bullet for the upcoming release.
  2. ogrekit applyTorque orientation problem

    You need to use the local X axis for example: [code] btVector3 torqueAxis = body->getWorldTransform().getBasis().getColumn(0); [/code] Here is some modified BasicDemo that might help you, you can use the cursor keys to move and rotate a 'character' capsule: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?p=29081#p29081
  3. Bullet Physics Changing RigidBody Position

    Instead of directly changing the position, it is better to change the velocity. Here is some sample code to show how this can work http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?p=29081#p29081
  4. Stopping 2 Rigid Bodies from Intersecting

    Start with an unmodified Bullet demo, such as Bullet/Demos/BasicDemo and make sure the collisions work properly there. Then compare the setup with your own, so find the problem. Thanks, Erwin
  5. Convex Hull 3D with gift wrapping - advanced

    We implemented a robust convex hull in our open source Bullet physics library too. There is an option to create a convex hull of a point cloud, used for the separating axis test and contact clipping. In a nutshell, we first compute the 3D convex hull, using integer arithmetic to avoid numerical issues. This can still generate coplanar faces. The algorithms we use (separating axis and contact clipping) can deal with those coplanar faces, so we could use this and have a robust solution. This implementation is used in the commercial 3D modeler Cinema 3D. For optimization reasons, I added a second pass that searches coplanar faces and merges them using a 2d convex hull algorithm (Graham scan). To project the 3D faces in the 2D plane, I compute the shortest arc from the xy-plane normal to the face normal, and use that to rotate the 3D vertices into the xy plane, and manually clear the Z coordinate. This second pass is not perfectly robust, so it could create small gaps in the convex hull. For more information, see [url="http://code.google.com/p/bullet/issues/detail?id=275"]http://code.google.c...s/detail?id=275[/url] and [url="http://code.google.com/p/bullet/source/browse/trunk/src/LinearMath/btConvexHullComputer.cpp"]Bullet/src/LinearMath/btConvexHullComputer.cpp[/url] and the initializePolyhedralFeatures method in [url="http://code.google.com/p/bullet/source/browse/trunk/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp#160"]Bullet/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp[/url] Do you have some unit tests with hard/degenerate cases that you can share? Thanks, Erwin
  6. I tried to reply your question in the Bullet forums here: [url="http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=7185"]http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=7185[/url] Note that everyone is busy, and the Bullet forums are not as active as gamedev.net, so you might not always get a reply. Thanks, Erwin
  7. GJK collision detection implementation from 2D to 3D

    I recommend reading Christer Ericson's 'real-time collision detection'. The book describes the 4 cases and voronoi regions in 3D (point, line segment, triangle, tetrahedron). This is also implemented in our Bullet physics engine, see this file: http://code.google.com/p/bullet/source/browse/trunk/src/BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.cpp
  8. Efficient RayCasts Through A Sweep and Sort

    [quote name='luca-deltodesco' timestamp='1303122418' post='4799826'] [size="2"][color="#1C2837"][quote]So in a large static world, S will be small, so the performance is great O(s log d) , with s size of S and d size of D.[/quote] I was thinking more, say a large static world built of tens of thousands of objects, so S would be very very large?[/color][/size] [/quote] I fixed the typo, obviously it has to be S(tatic) will be large and D(ynamic) small, so the performance of the dynamic AABB tree will be great., just like SAP. (in other words, both exploit temporal coherence). So in a nutshell, the performance of a dynamic bounding volume/AABB tree (DBVT) is better than SAP in most cases for overlapping pair search, and DBVT handles ray test/swept object queries much better. Thanks, Erwin
  9. Efficiency : Bullet much slower than PhysX?

    PhysX has a highly optimized swept capsule test, for its character controller. Bullet uses a generic, iterative convex sweep. Can you share a benchmark, so we might optimize it in a future version of Bullet?
  10. Efficient RayCasts Through A Sweep and Sort

    [quote name='luca-deltodesco' timestamp='1303084844' post='4799660'] How does a dynamic AABB tree perform for say; a very large static world with few dynamic bodies? As opposed to say something like a simple regular grid which would seem to be very good for such a case, certainly sort and sweep is not a good idea for such a scenario [/quote] This case performs extremely well: Keep two dynamic trees, tree S for static (static/non-moving/deactivated objects) and tree D dynamic/moving objects. When objects deactive you can move them from D to S, and on activation move them from S to D. Insertion, update and removal are all fast, incremental operations. Rebalancing is performed incrementally over many frames, by removing and re-inserting a very small percentage of the nodes each frame. To find all pairs: query all objects from D against D and D against S. So in a large static world, [color="#ff0000"]D will be small and S large[/color], so the performance is great O(s log d) , with s size of S and d size of D. There are plenty of other optimizations to make a dynamic AABB tree a better choice over sweep and prune in many cases. This benefit increases when the percentage of moving objects grows and when the relative speed increases (a bad case for most SAP implementations, because of the many swaps). Thanks, Erwin
  11. Efficient RayCasts Through A Sweep and Sort

    I implemented a raycast through the sweep and prune for Havok, back in 2003 and discussed it here: [url="http://groups.google.com/group/comp.graphics.algorithms/browse_thread/thread/969399a738a90bf2"]http://groups.google...69399a738a90bf2[/url] It optimized the worst case of a diagonal ray through the entire world. I discussed it with Gino van den Bergen and he described the algorithm more in detail in his book called "Interactive Collision Detection in 3D environments". Still, it is more efficient to add a second acceleration structure, specifically for ray tests, such as a dynamic AABB tree. The AABB tree outperforms the sweep and prune in most cases, so this give you a single acceleration structure that can find all overlapping pairs and perform ray casts (and other sweeps). This is what I implemented in Bullet and more recently Erin added such dynamic AABB tree broadphase as default in Box 2D. Thanks, Erwin
  12. OBB-OBB Collision data

    Gjk gives you a separating axis, distance and closest points if objects don't overlap. It requires an additional algorithm for the penetrating case, such as SAT or expanding polythope algorithm (EPA). Still, this only gives you an axis (normal) and a single point. To gather multiple points for polyhedra, you better simply combine SAT and clipping. An alternative to clipping is contact caching, where you add a contacts to a small cache, and update this cache (in Bullet this is called a persistent contact manifold). You can use any method to add contacts to this cache, including GJK/EPA. GJK/EPA/contact caching is more complicated but also more generic, it can deal with a wider range of shape types. For example implicit (not tesselated) cylinders, cones etc. Bullet implements all those methods, so you can compare. Is the SAT/clipping idea clear?
  13. How accurate is Bullet for this type of collisions?

    Bullet is just for games and movie physics effects, not for realistic engineering. It has been used in the destruction movie 2012, which required a lot of work on authoring and pre-fractured data, convex decomposition etc.. So it mostly depends on your toolchain. The collision detection can be very accurate, but the collision response is approximate, due to iterative constraint solver. You can increase the quality by using a smaller time step, more solver iterations etc.
  14. OBB-OBB Collision data

    One approximate way to generate contact points between two convex polyhedra A and B, is the following recipe: 1) find a separating axis between A and B using your favorite method (SAT, GJK etc) 2) find reference face on A and a incident face on B with a normal that is closest to this separating axis 3) perform Sutherland-Hodgman clipping on the vertices of this face on A against the polyhedron B This clipping can be performed either in worldspace or in the local space of B, using the faces connected to face B I recently implemented this method in the open source Bullet physics library, part of the Bullet 2.78 release, so you can test the implementation and read the code here: [url="http://code.google.com/p/bullet/source/browse/trunk/src/BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.cpp"]http://code.google.c...actClipping.cpp[/url] in particular [font="Monaco,"][color="#000000"]btPolyhedralContactClipping[/color][color="#666600"]::[/color][color="#000000"]clipHullAgainstHull and [/color][/font][font="Monaco,"]clipFace.[/font] [font="Monaco,"] [/font] [font="Monaco,"][color="#000000"]For general convex polyhedra you need to compute the connectivity and connected faces ([font=Monaco,]m_connectedFaces in above code), Bullet uses the btConvexHullComputer for this. For the special case of OBB-OBB this information can be hard-coded, you can see the OBB-OBB clipping code in ODE/Bullet here: [/font][/color][/font][font=Monaco,][url="http://code.google.com/p/bullet/source/browse/trunk/src/BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp#574"]http://code.google.com/p/bullet/source/browse/trunk/src/BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp#574[/url][/font] [font="Monaco,"] [/font]Thanks, Erwin
  15. Sweep test and physics

    [quote name='wildbunny' timestamp='1301563908' post='4792509'] [quote name='raigan' timestamp='1301068878' post='4790395'] Awesome, thanks so much! I'll move questions to the comments on the post [/quote] No problem Since i wrote the article a number of people have asked to modify the discrete solver i used in the demos to account for penetration resolution; thereby making the comparison more 'real word' since no discrete solver can really exist without it.... I have done so, please take a look if any of you were wondering what this would look like, and thank you Dirk and Erin for the feedback Cheers, Paul. [/quote] Speculative contact constraints as well as contact clamping in 3D (both using conservatice advancement) is available in the new C++ Bullet 2.78 SDK: [url="http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=6624"]http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=6624[/url] Check out the Demos/CcdPhysicsDemo. Thanks, Erwin
  • Advertisement