Search Unity

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:
    196
    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:
    2,431
    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.