Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  How can i detect if two ropes are twisted
#11
(03-07-2020, 10:24 AM)josemendez Wrote: Each frame the engine makes all contact information available to you directly. This is as efficient as it gets, as you're given direct access to the same information used by the engine to resolve collisions. Filtering it to suit your needs is completely up to you, you can of course keep a counter per actor and count the amount of contacts for each one if you wish.

How should i filter out the contacts ? Like which contact belongs to each actor ? How can i keep a contact counter for each actor. Could you please give me some hints.

Thanks
Reply
#12
(03-07-2020, 10:26 AM)rand123 Wrote: How should i filter out the contacts ? Like which contact belongs to each actor ? How can i keep a contact counter for each actor. Could you please give me some hints.

Thanks
Hi there,

These are very basic programming concepts, you should check some info on C# variables / arrays / listsĀ  and other structures.

You already know how to identify white pair of actors are involved in each contact, just like we did before:

Code:
ObiActor a1 = solver.particleToActor[contact.particle].actor;
ObiActor a2 = solver.particleToActor[contact.other].actor;

So just add a counter for each actor, and increment it every time you find the actor involved in a contact. This can be done in multitude of ways (a dictionary mapping actor to counter, a component in each actor that contains a counter, etc).
Reply