Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  ObiColliders not working with scripted ropes
#1
Hi there,

This is my first post here, apologies if it's in the wrong place or if I'm just doing something very silly...
I think have come across an issue with the Obi Collider script.

Both of the sample scenes I have found where the ropes are generated through scripts (RopeGrapplingHook & RopeNet samples) do not collide with the environment, despite Obi Collider script components being present on the relevant game objects (environment mesh for RopeNet and level geometry for RopeGrapplingHook).

I have tried a number of different settings to enable collision between ropes generated from scripts but nothing has worked collision obi collider thicknesses, obi rope surface based collision, various distance fields, collision margins in the Obi solver, etc.

In summary, when using GrapplingHook.AttachHook() for rope creation, collisions do not work. When using ropes created via the Unity inspector (not from scripts), everything seems to work fine. Should be able to repro by observing RopeNet demo dropping below the environment in the latest version of the ObiRope package (v6.2).

Thanks!
Reply
#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
#3
Thank you! The filter works like a charm.

Also, thanks for the reference - I'll read through the FAQ before posting again Ángel
Reply