11-10-2021, 02:23 PM
(11-10-2021, 08:57 AM)josemendez Wrote: Your rope:
Code:var myFilter = ObiUtils.MakeFilter(1 << 1, 0);
for (int i = 0; i < rope.solverIndices.Length; ++i)
rope.solver.filters[rope.solverIndices[i]].filter = myFilter;
The sphere:
Code:sphereObiCollider.Filter = ObiUtils.MakeFilter(ObiUtils.CollideWithEverything, 1);
The cube:
Code:cubeObiCollider.Filter = ObiUtils.MakeFilter(ObiUtils.CollideWithEverything, 0);
That's one possibility: giving the rope a mask that only collides with category 1, placing the sphere in category 1 and the cube in category 0. You could do it in many other ways.
Filters are made of a mask and a category. The mask (the "Collides with" field) is the first parameter of the ObiUtils.MakeFilter() function. Just keep in mind the mask is a bit mask (just like Unity's layer masks), so you build it by simply or'ing together bits. For instance, to build a mask that collides with categories 1, 3, and 6:
Code:int mask = (1 << 1) | (1 << 3) | (1 << 6);
ObiUtils.MakeFilter(mask, 0); // used category 0, could use any other.
Note you need to be familiar with bitwise operators to understand this. If you're not sure what this means, look them up. There's many tutorials around dealing with bit manipulation (in C# as well as other languages), the above link to Unity's layer masks is a good starting point as they work just like Obi's filter masks.
Thanks this was very helpful!