Search Unity

Extendable 'hook' mechanism

Discussion in 'Animation' started by RyanPaterson, Apr 27, 2014.

  1. RyanPaterson

    RyanPaterson

    Joined:
    Dec 14, 2013
    Posts:
    77
    Hi,

    I've got a hook/ james bond style grapple thing going on.

    Super simple mechanics - but i've been using a sphere, and when the sphere hits the surface the player follows.

    I'd like to model a 'hook' head, and have it extend, with a wire to it's destination. Though I have no idea how i'd go about the wire?

    Ideas would be really appreciated, Thank you!
     
  2. TheCCJ

    TheCCJ

    Joined:
    May 2, 2013
    Posts:
    71
    Here's a simple trick you can use; some might see it as hacky, but it's really a simple setup, and should work for your purposes, as long as the wire being taut isn't an issue.

    Essentially the wire is a simply primitive. Could be a cylinder, or cube, or whatever. This is actually given a two-bone skeleton, which has a root and an end, and the primitive is weighted to it (with one end being weighted 100% to the root, the other to the end). The root stays at the firing point (in your case, the player's hand/gun/whatever), and the end is a child of/attaches to and follows the hook when fired, stretching the primitive out and allowing it to compress as needed.

    The reason a skeleton was used is that it allowed for infinite lengths to be made, as the bone location defines the length of the wire at any point.

    This was a long time ago when I used this sort of solution, so the particulars of how it was coded up are covered in mental cobwebs, but it's a fairly straightforward thing, and should be pretty easy to set up. Biggest issue we ever ran into was the texture couldn't be overly detailed, as the extension of it would stretch any detail all to hell. I doubt it would really be an issue in your case.
     
  3. RyanPaterson

    RyanPaterson

    Joined:
    Dec 14, 2013
    Posts:
    77
    Hi!

    Thank you for the detailed reply I really appreciate it.

    It's a good approach, it does seem something like this could become pretty advanced to be done visually staggering.
    But it's just mechanics i'm after so thank you.

    I'll give your method a go!