Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

A grapple hook made by line renderer that has two different textures

Discussion in '2D' started by ELKeshawy, Dec 8, 2022.

  1. ELKeshawy

    ELKeshawy

    Joined:
    Nov 22, 2022
    Posts:
    4
    So im basically doing a grappling hook using distance joint and a line renderer but i dont want it to be simply a line, i want to make it a hook/dagger that extends till it hits the enemy

    so i have this sprite of a dagger that i want only the middle part to be tiled as it stretches upload_2022-12-8_13-37-1.png
    same way it happens when you use it in a sprite shape like this
    upload_2022-12-8_13-38-21.png
    any tips or ways to make this happen ?
     
  2. karliss_coldwild

    karliss_coldwild

    Joined:
    Oct 1, 2020
    Posts:
    604
    What exactly do you need help with?

    It sounds like you have half of the work already done.

    Are you asking how to make the line renderer look like the sprite shape? Why don't you use sprite shape (which you have already working) instead of line renderer?

    Are you asking how to implement the distance joint part? Are you asking how to implement the shooting part?
     
  3. ELKeshawy

    ELKeshawy

    Joined:
    Nov 22, 2022
    Posts:
    4
    I cant control the sprite shape’s starting and ending point like line renderer i have everything implemented except i want the line to look like the bottom photo with the line texture tiling the middle part only
     
  4. karliss_coldwild

    karliss_coldwild

    Joined:
    Oct 1, 2020
    Posts:
    604
  5. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,544
    You can use HingeJoint2D to connect the segments and a single DistanceJoint2D (using Max Distance Only) to connect the ends to stop stretching as demonstrated here: