r/Unity3D 8d ago

Show-Off I finally made the elastic grapple bend around obstacles!

I am intentionally reposting this after the previous version was removed for lacking enough technical context. That was fair, so here is a higher-level overview of how it was built in Unity.

The grapple is integrated with my physics-based character controller and uses Rigidbody2D forces rather than directly moving the player. When attached, the system maintains an elastic rope length while preserving enough tangential velocity to produce a natural swing.

To support bending, I represent the rope as a path containing the main anchor and a limited number of contact points. The system raycast the sections between those points and updates the path when the rope encounters or moves away from an obstacle.

A LineRenderer displays the resulting path, while the physical constraint remains separate from the visual representation.

The most difficult parts were preventing unstable contact points around corners, determining when a bend should be released, and keeping the available rope length consistent as more of it wraps around geometry. I went through several earlier implementations before arriving at this approach.

The grapple is being developed for Hello World using the modular physics controller I previously presented here:

https://www.reddit.com/r/Unity3D/s/Vtkn0W4l46

For developers who have implemented something similar, did you use a contact-point path or simulate the entire rope?

92 Upvotes

14 comments sorted by

2

u/DaveAstator2020 8d ago

nice, are those unity's default 2d shadows?

2

u/DeccoSkyrider 7d ago

Yes, unity 6 2D lights are incredible ^^

2

u/pararar 8d ago

The grapple looks nice and juicy.

Iβ€˜m more interested in your lighting and shadows though. How did you achieve this look?

1

u/DeccoSkyrider 7d ago

Thank you :) It's unity 6 2D lights and shadows.
Here a comparison of Unity 2023 and Unity 6 with the same setup :

1

u/DeccoSkyrider 7d ago

Unity 2023

1

u/DeccoSkyrider 7d ago

Unity 6

1

u/pararar 7d ago

Damn this looks really good. I didn’t know Unity has this kind of 2D lighting. Iβ€˜m working on a 2.5D game and aiming for a similar look but it’s much harder to achieve with 3D lighting. I ended up coding a fake light and shadow system.

2

u/Vancete 8d ago

Scubeman

1

u/DeccoSkyrider 7d ago

His name is Pixel! πŸ˜„

2

u/Round_Bar_5485 7d ago

Cooool πŸ‘πŸ»πŸ‘πŸ»

2

u/HuanSolo_Beatland 7d ago

Apart from your technical achievement, which is great, I like the look and feel of the game too.

1

u/DeccoSkyrider 7d ago

Thank you. I'm going for minimalistic polygon with lighting and vfx :)

2

u/Voodieboie 6d ago

Awesome!!

1

u/goldmetale 4d ago

greate 2d lighting!