How can I merge ManifoldPoints properly?

Post Reply
donggas90
Posts: 17
Joined: Tue May 19, 2015 10:01 am

How can I merge ManifoldPoints properly?

Post by donggas90 »

I writing a contact and block response system like the other physics engines such as NVIDIA PhysX.
Known that the Bullet using Manifold, so I queried all of PersistentManifolds after stepSimulate().
Then could recognize some odd manifolds were there,
they have same body0 and body1 or their contact points was empty.
I couldn't understand why they were there whatever I ignored them.
And there were some PersistentManifolds were from same bodies pair.
In similarly, couldn't understand why they were there whatever collected all of their contact points to a list.
Finally, I want to make that contact points in the list to one contact point like other physics engines.
First, I thought that just sum the informations and divide by count to get average. but I don't think it's a good idea.
because average is not proper method for some informations such as impulsed force.
Would anyone tell me right way?
Thanks.
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: How can I merge ManifoldPoints properly?

Post by drleviathan »

I have contemplated a similar (or same?) problem: how to collapse the information stored in all the points of a btPersistentManifold into a useful form that represents one "contact event". My motivation: I'm working on a scriptable game engine of sorts and one of the features I'd like to support is for scripts to be able to detect collision events (with info like: point-of-contact, normal, relative speeds) between objects and then execute custom code for each event.

I haven't tried to solve the problem properly yet. Instead as an initial implementation I just take the first point out of the manifold and use that as input for the full "contact event". Nevertheless I'll eventually get back to that feature and try to make it smarter. If anyone has an interesting solution or lessons learned I'd love to hear them.

The only idea I've had so far for a fancier system goes something like this:

(1) Examine all the points of the manifold and group them by similar normals or shape parts.
(2) For each group compute: average-normal and average-contact-point.
(3) Generate a "contact event" for each group.
donggas90
Posts: 17
Joined: Tue May 19, 2015 10:01 am

Re: How can I merge ManifoldPoints properly?

Post by donggas90 »

drleviathan wrote: (1) Examine all the points of the manifold and group them by similar normals or shape parts.
(2) For each group compute: average-normal and average-contact-point.
(3) Generate a "contact event" for each group.
That's right.
but I have just wanted to find a "Magic" for this. :lol:
We would make it manually.
Thanks.
Post Reply