#I did use linerenderer for grappling hook but it's like metal pipe more than rope also buggy

1 messages · Page 1 of 1 (latest)

peak burrow
#

This is my work

#

I would be glad if you guys know how to make this less buggy and give feel of rope instead of pipe

royal raft
#
  1. Constrain line rotation - it’s rotating across an axis it shouldn’t in a 2D game making it look ”buggy”
#
  1. The player is at a fixed distance from the block - the length of the line - which is why it snaps, and why it’s so rigid and metal-like. For a rope-like system, you need a different implementation.
#

Solving number 1 should be easy. Either you are rotating the line across 3D space in code, or you’ve some sort of RigidBody physics going on. For the former, you can solve it by simply ignoring rotating on that third axis, for the latter you can solve it with the constrain rotation option on the RigidBody.

#

Solving number 2 can be more difficult depending on how realistic you want it done. A first step might be splitting up the line - both as the one control the players position, and the one that is displayed - into multiple connected lines of equal length. A second step might be splitting it further and letting the lines be more free and able to contract and stretch.

#

There are probably assets on premade such systems in Unity, and tutorials on how to do such programmatically, and probably such aimed for Unity too.

south abyss
#

You can use a spring joint component to make it feel more like a rope. This will allow you to adjust parameters like if the rope should break at a certain level of force, or how "springy" the rope should be.

#

I can't send links for some reason... This should work though, here's a link to the Unity docs for the spring joint. (Remove the space between h and ttps)
h ttps://docs.unity3d.com/6000.3/Documentation/Manual/2d-physics/joints/spring-joint-2d-reference.html

royal raft
south abyss
#

Yes you would need multiple spring joints connected together, but the component also has an in-built way of doing that with the anchor variable.
And thanks! :)