User contact points

User avatar
frca
Posts: 39
Joined: Sat May 02, 2009 9:38 am

User contact points

Post by frca »

Hi,
I would like to generate some contact points between two objects. How to do that? Which parameters do they support? Is it possible to create contact points that have only influence in tangential direction (i. e. friction) and not in normal direction (i. e. no bounce, body continues moving in normal direction)?
I will probably add more questions here as I have more precise idea what I need.
Thanks.
User avatar
frca
Posts: 39
Joined: Sat May 02, 2009 9:38 am

Re: User contact points

Post by frca »

Simpler question: Is it somehow possible to create my own contact points during simulation? And if so, is it recommendable?
Thanks
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: User contact points

Post by Erwin Coumans »

You can add your own contact points to a persistent contact manifold, but make sure to refresh the points each frame (Bullet keeps contacts persistent). Contact management is non-trivial, so it might be useful to digg into the source code of some of the collision algorithms (such as Bullet/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp).

In a nutshell, the following methods are useful:

Code: Select all

[...]
manifoldPtr = dispatcher->getNewManifold(body0,body1);
[...]
//add some contact point
manifoldPtr->addManifoldPoint(newPoint);

//to remove/update contact points, call either removeContactPoint, clearManifold or refreshContactPoints 

//before exiting the program/simulation, release memory using releaseManifold
dispatcher->releaseManifold(m_manifoldPtr);
that have only influence in tangential direction
Contact points always have a normal component. If you need a special constraint, such as a friction-only constraint, it is best to implement your custom constraint, derived from btTypedConstraint. Perhaps you can use btGeneric6DofConstraint as a starting point?

Hope this helps,
Erwin
User avatar
frca
Posts: 39
Joined: Sat May 02, 2009 9:38 am

Re: User contact points

Post by frca »

Hi, I'm here again reviving old topic. I would like to make a collision between some rigid bodies and a world, which is represented by my own collision shape. For this shape, bullet does not have a datatype. What should I pass to the getNewManifold function in this case?

I was considering some other approach too. What effect do the manifolds have in practice? Could they be completely avoided by applying forces or something like that? Is it advisable to completely avoid manifolds in case of my own specific collision shapes, for which I will have to create specific collision detection functions as well?

Thanks