Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ropearound like physics
#8
(04-06-2020, 09:57 AM)relevantname Wrote: If I use a real tube for the rope(to prevent left-right swinging), the rope's particles collides with this tube all the time and I need to extract the contact points other than the tube. Is there an easy way to do this other than loop through the whole contacts list every frame and pick the objects other than the tube? (Like, collide with object but not collect contact points for this object)

A collision with any object means that contact points have been generated between the rope and the object. You can't have a collision with no contact points generated.

Now, performing any kind of filtering over the contacts requires to iterate over them at least once. Even when Unity calls OnCollisionEnter() for a given pair of objects, internally it has iterated trough all contacts in the scene to find out what callbacks to call.

Broadly speaking, there's no way to tell if an object is or isn't in a list without looking at all objects at least once.

So, the easiest (and only) way to do what you need (in any engine) is to iterate over the contacts list once and pick whatever objects you need.
Reply


Messages In This Thread
Ropearound like physics - by relevantname - 03-06-2020, 04:43 PM
RE: Ropearound like physics - by josemendez - 03-06-2020, 04:48 PM
RE: Ropearound like physics - by relevantname - 03-06-2020, 08:18 PM
RE: Ropearound like physics - by josemendez - 04-06-2020, 08:06 AM
RE: Ropearound like physics - by relevantname - 04-06-2020, 08:46 AM
RE: Ropearound like physics - by josemendez - 04-06-2020, 09:24 AM
RE: Ropearound like physics - by relevantname - 04-06-2020, 09:57 AM
RE: Ropearound like physics - by josemendez - 04-06-2020, 10:13 AM
RE: Ropearound like physics - by relevantname - 04-06-2020, 10:49 AM