Hi,
I've searched in the documentation and i was unable to find information about joints and contacts points feedback.
The goal is, after time step, to get an information about how many force/torque the joint applied to the 2 bodies.
Something like ODE's dJointSetFeedback function. I need to know the forces and torques applied by regular constraints AND the contact points constraints.
Is it possible ?
Thank you
Joint and Contact points Feedback
-
- Posts: 26
- Joined: Mon Sep 21, 2009 7:30 am
Re: Joint and Contact points Feedback
For contacts force: http://bulletphysics.org/Bullet/phpBB3/ ... 36&start=0
As for joints, as I understand joints are inherited from btTypedConstraint, which also have m_appliedImpulse member.
EDIT: By joints I mean constraints. As I understand joints in ODE are constraints in Bullet.
As for joints, as I understand joints are inherited from btTypedConstraint, which also have m_appliedImpulse member.
EDIT: By joints I mean constraints. As I understand joints in ODE are constraints in Bullet.
-
- Posts: 35
- Joined: Mon Jul 20, 2009 12:58 pm
Re: Joint and Contact points Feedback
Thank you, i will check this topic that seems to be good for me
-
- Posts: 35
- Joined: Mon Jul 20, 2009 12:58 pm
Re: Joint and Contact points Feedback
Hi, I've checked the topic as you suggested.
The problem is that this method don't give what is the geometry that have been in contact with another:
It gives body1 and body0 only, not the collision shapes that are involved in this collision.
I've tried to use the gContactAddedCallback and, in this case we can identify what are the geoms in contact. The problem, now, is that the m_appliedImpulse was not yet computed at this time (the value is very low)... then it is not possible to know what are the forces applied by this contact point.
With ODE (sorry for naming it again !!) the contact point is associated to 2 geoms (not bodies) and it is possible to get the FeedBack of the force between the geometries : is there something like that in Bullet ?
Another suggestion to know what are the forces applied by a contact point from a geometry to another ?
Thank you for your help.
The problem is that this method don't give what is the geometry that have been in contact with another:
Code: Select all
int numManifolds = collisionWorld->getDispatcher()->getNumManifolds();
for (i=0;i<numManifolds;i++)
{
btPersistentManifold* contactManifold = collisionWorld->getDispatcher()->getManifoldByIndexInternal(i);
btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0());
btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->getBody1());
I've tried to use the gContactAddedCallback and, in this case we can identify what are the geoms in contact. The problem, now, is that the m_appliedImpulse was not yet computed at this time (the value is very low)... then it is not possible to know what are the forces applied by this contact point.
With ODE (sorry for naming it again !!) the contact point is associated to 2 geoms (not bodies) and it is possible to get the FeedBack of the force between the geometries : is there something like that in Bullet ?
Another suggestion to know what are the forces applied by a contact point from a geometry to another ?
Thank you for your help.
-
- Posts: 26
- Joined: Mon Sep 21, 2009 7:30 am
Re: Joint and Contact points Feedback
You can get collision shape from body. getCollisionShape() or getRootCollisionShape().
Also manifold point have members partId and indexId. indexId store triangle id if it was collision with trimesh.
partId contains index of shape if collision was with compoundShape (If I correctly understand when was reading change log).
Also manifold point have members partId and indexId. indexId store triangle id if it was collision with trimesh.
partId contains index of shape if collision was with compoundShape (If I correctly understand when was reading change log).
-
- Posts: 508
- Joined: Fri May 30, 2008 2:51 am
- Location: Ossining, New York
Re: Joint and Contact points Feedback
Does this mean i can implement a callback for when a specified force has been breached in the constraint? This will be useful e.g. for decoupling trains, ripping off car doors, ripping of limbs... In fact I think I could have a lot of fun with this. :>As for joints, as I understand joints are inherited from btTypedConstraint, which also have m_appliedImpulse member.
-
- Posts: 26
- Joined: Mon Sep 21, 2009 7:30 am
Re: Joint and Contact points Feedback
I think yes. In this forum was some topics exactly about using applied impulse to brake constraints, or for example to brake compound object to separate objects.sparkprime wrote:Does this mean i can implement a callback for when a specified force has been breached in the constraint? This will be useful e.g. for decoupling trains, ripping off car doors, ripping of limbs... In fact I think I could have a lot of fun with this. :>As for joints, as I understand joints are inherited from btTypedConstraint, which also have m_appliedImpulse member.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Joint and Contact points Feedback
Yes. In fact we will add support for breakable constraints, by adding a threshold: whenever this threshold is exceeded (m_appliedImpulse>threshold), the constraint will be deactivated.sparkprime wrote:Does this mean i can implement a callback for when a specified force has been breached in the constraint? This will be useful e.g. for decoupling trains, ripping off car doors, ripping of limbs... In fact I think I could have a lot of fun with this. :>As for joints, as I understand joints are inherited from btTypedConstraint, which also have m_appliedImpulse member.
Thanks,
Erwin
-
- Posts: 35
- Joined: Mon Jul 20, 2009 12:58 pm
Re: Joint and Contact points Feedback
Hi,
I've made some tests by creating a 5 boxes body (body0) that is on the floor ($$defaultground) (see picture).
The result is:
If i understand, idxa from contactManifold->m_index1a (from btPersistentManifold) seems to be the index of the box that tutch the floor.
But in this case what are idx0 and idx1 from
The floor is a body with 1 geom ... idx1, idx0 or idxa should show a '0' somewhere ?
I do something wrong ?
I've made some tests by creating a 5 boxes body (body0) that is on the floor ($$defaultground) (see picture).
The result is:
Code: Select all
ProcessContactPoints numManifolds=5
-> 01CA3008 01CA7CB0 idxa:0 contacts:3
/body0 on /$$defaultground
idx0=3 idx1=129433232
idx0=3 idx1=129433232
idx0=3 idx1=129433232
-> 01CA3008 01CA7CB0 idxa:1 contacts:3
/body0 on /$$defaultground
idx0=4 idx1=129433232
idx0=4 idx1=129433232
idx0=4 idx1=129433232
-> 01CA3008 01CA7CB0 idxa:2 contacts:3
/body0 on /$$defaultground
idx0=2 idx1=129433232
idx0=2 idx1=129433232
idx0=2 idx1=129433232
-> 01CA3008 01CA7CB0 idxa:3 contacts:3
/body0 on /$$defaultground
idx0=1 idx1=129433232
idx0=1 idx1=129433232
idx0=1 idx1=129433232
-> 01CA3008 01CA7CB0 idxa:4 contacts:0
But in this case what are idx0 and idx1 from
Code: Select all
btManifoldPoint& cp = contactManifold->getContactPoint(j);
_cwprintf(L"\tidx0=%d idx1=%d\r\n",cp.m_index0,cp.m_index1);
I do something wrong ?
You do not have the required permissions to view the files attached to this post.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Joint and Contact points Feedback
No, please check rrck comment before:
For basic shapes, like btBoxShape, btSphereShape and btConvexShape you just use the collision shape of the collision object (so part/index is not initialized).
part/index is only valid for btBvhTriangleMeshShape (pointing to a sub-mesh and triangle) or btCompoundShape (pointing to a child shape index).
Thanks,
Erwin
For basic shapes, like btBoxShape, btSphereShape and btConvexShape you just use the collision shape of the collision object (so part/index is not initialized).
part/index is only valid for btBvhTriangleMeshShape (pointing to a sub-mesh and triangle) or btCompoundShape (pointing to a child shape index).
Thanks,
Erwin