2D Swinging Obstacle

I have an animated swinging rope, 5 parts to the rope each with a BoxCollider2D. I have a character that i want to run along jump onto the rope, swing across the gap and jump off the rope.
The character also has a BoxCollider2D and a Rigidbody2D. I’m trying to get the character to stick to the rope (Google search ends up with lots of results on how to stop colliders sticking).

I’m using OnTriggerEnter2D which just provides me with Debug msg to say the collders have collided but I cant figure out how to get the character to stick to the rope on collision?

Any help much appreciated.

This solution will depend on a lot that either you already have or will have to write.


The short story is you want to limit movement and have character position cling to the rope position when you enter the collider


I would go about this by first going into my movement script and creating a bool isHolding and when the player enters the collider (and maybe while holding a certain button) then set isHolding to true; while isHolding is true all horizontal movement is restricted, and would do something like this (very rough) but have the player.transform.position = collidedRope.transform.position (again, very rough, toy around with the different transform and vector movements to see what looks best for you).


I’m at work and away from a compiler (as well as Unity) and would need a little time with both to write a script that would actually look pretty, but that is the rough idea.

I’ll give it a try, I see what you mean.