A similar question had been asked already around here but what I'm looking for is a little bit different. I want to do kinematic collision detection with the use of solvers. So far I used my own collision tests but I would like to string this together with Bullet as I use it already for objects using dynamic physics. The problem is now how to do this properly. I looked at the ConcaveConvexcastDemo and CollisionInterfaceDemo but I'm not sure if they can do what I need.
So let's take an example. There is a kinematic object moving relatively fast ( let's say a projectile like an arrow ). Using dynamics this would tunnel through objects. I want to test this kinematic object for a collision with bullet shapes ( representing world geometry and props ). Is there a way to do this scenario without the help of solvers and without tunneling?
Another example is a kinematic object moving along a linear path without acceleration. Another object moves in front of it with the same speed but they just don't touch each other. The collision test should not register a collision under this situation. Looking at ConcaveConvexcastDemo and CollisionInterfaceDemo I get though the impression that those do not take speed into account. Am I correct or wrong there?
Question about collision detection without solvers
-
- Posts: 198
- Joined: Mon Sep 04, 2006 5:31 pm
- Location: Switzerland
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Question about collision detection without solvers
You should use the ConcaveConvexcastDemo, in particular Bullet/src/BulletCollision/CollisionDispatch/btCollisionWorld.h
This gives you the fraction how much you can move, until you hit the first object.
convexSweepTest takes the current (from) and final (to) transform, so you can produce this final (to) transform using your desired motion (with velocity). This motion to get the final transform (to) can be pure linear motion (only linear velocity, without rotation), or including angular velocity (rotation), that is up to you to decide.
Hope this helps,
Erwin
Code: Select all
void convexSweepTest (const btConvexShape* castShape, const btTransform& from, const btTransform& to, ConvexResultCallback& resultCallback, short int collisionFilterMask=-1);
convexSweepTest takes the current (from) and final (to) transform, so you can produce this final (to) transform using your desired motion (with velocity). This motion to get the final transform (to) can be pure linear motion (only linear velocity, without rotation), or including angular velocity (rotation), that is up to you to decide.
Hope this helps,
Erwin
-
- Posts: 198
- Joined: Mon Sep 04, 2006 5:31 pm
- Location: Switzerland
Re: Question about collision detection without solvers
So the second example I mentioned would work with the convexSweepTest? What about tunneling? Would this still happen in this kind of test?
-
- Posts: 198
- Joined: Mon Sep 04, 2006 5:31 pm
- Location: Switzerland
Re: Question about collision detection without solvers
Let's add another question going into a similar situation. If I want to implement something like a "trigger" how would this work in Bullet? With trigger I mean an area ( defined by a bullet shape ) that I want to monitor continuously for what objects are inside. You mentioned the convex cast method but this checks for a moving shape. What I want is testing for collisions of a shape not required to move ( if the player stands still for example ). I thought about using a conventional rigid body but without a collision response since I've seen a tag named something_NORESPONSE somewhere in the sources but this would leave the question how I can detect a collision with those ( since needsCollision in the dispatcher does not mean a real collision happened ).