Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

add fishing line physics to a line render

Discussion in 'Physics' started by Sylon87, Sep 16, 2018.

  1. Sylon87

    Sylon87

    Joined:
    Aug 20, 2018
    Posts:
    28
    hello everyone.
    i want to add physics to my line render to simulate a fishing line, like now what i have is this

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class line : MonoBehaviour {
    6.  
    7.     public Transform origin;
    8.     public Transform target;
    9.  
    10.     public LineRenderer lineRenderer;
    11.  
    12.     // Use this for initialization
    13.     void Start () {
    14.        
    15.     }
    16.    
    17.     // Update is called once per frame
    18.     void Update () {
    19.  
    20.         lineRenderer.SetPosition(0,origin.position);
    21.         lineRenderer.SetPosition(1,target.position);
    22.        
    23.     }
    24. }
    25.  
    there is a way to add a physics to it?
     
  2. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    394
    Strings, cables, ropes in the real world have very complicated physics. At rest, a string held at both ends will sag into a catenary curve, which by itself needs more complex math than many things in Unity. Add wind or the strength of the fish and it gets even more complicated.

    Look through the store for wire or cable solutions. There are a few. I have tried several and they often have some annoying limitations.