Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  ObiColliders not working with scripted ropes
#2
Make sure collision filters are properly setup. From our FAQ:

Quote:I set up colliders as explained in the manual, but I canĀ“t get Obi objects to collide with them. Is this a bug?

Most likely the cause is that collisions are being filtered out. In 6.1 and older versions, only particles and colliders in separate phases will generate contacts. In 6.2 and up, particles and colliders use categories and masks to determine if they should collide with each other. Also, keep in mind that PolygonCollider2D is not currently supported. See the collisions manual page for detailed info.

When building a path for the rope to follow, one of the arguments for AddControlPoint is the filter. This is a 32-bit integer where the 16 most significant bits define the collision mask, and the 16 less significant bits define the category.

You can build the filter yourself using bitwise operations, and there's also helper functions if you don't want to mess with bits yourself. ObiUtils.MakeFilter will create the filter for you given a mask and a category. For instance:

Code:
int filter = ObiUtils.MakeFilter(ObiUtils.CollideWithEverything,0);

This builds a filter for category 0 that allows the rope to collide with everything.
Reply


Messages In This Thread
RE: ObiColliders not working with scripted ropes - by josemendez - 29-07-2021, 08:47 AM