Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Best way to make a Whip?

Discussion in 'General Discussion' started by Hazneliel, Jul 21, 2017.

  1. Hazneliel

    Hazneliel

    Joined:
    Nov 14, 2013
    Posts:
    305
    Hello, I have been trying to make a physical whip, I tried using dynamic bone and Unity Cloth for this but it wont work that way.

    Anybody has implemented this that can give me some advice?

    Thank you.
     
  2. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
  3. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,554
    The best idea to make a whip is not to use physics. You animate the whip (with bones and blendshapes), and then use prebaked animation. Trying to use physics is asking for trouble, because it'll wrap around everyhting and get stuck often - plus the whip is incredibly hard to control.

    If you're trying to make some sort of motion controller experience with a whip, then try using joint chains. Unity cloth won't interact with the world. Rigidbody joined together with joints will.
     
    Fera_KM, dogzerx2, Kiwasi and 4 others like this.
  4. Deleted User

    Deleted User

    Guest

    For some weekend fun?
     
  5. Hazneliel

    Hazneliel

    Joined:
    Nov 14, 2013
    Posts:
    305
    I would need to make it physics based as it is going to be used with VR
     
  6. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,554
    If you really, really, really, REALLY want a physical whip, try linked rigidbodies. You'll need plenty of luck with it, because a whip is very hard to control.

    A simpler option would be to recognize "whipping" gesture and play predefined animation anyway.
     
    mandisaw, frosted and theANMATOR2b like this.
  7. LMan

    LMan

    Joined:
    Jun 1, 2013
    Posts:
    493
    What does the whip need to be able to do?

    Is it wrapping around other rigidbodies and pulling them?
     
  8. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    This is the approach I would use. I've done lots of stuff with this approach. It works, but it needs a lot of tuning to get right.

    If you go with this approach, I would suggest separating the rendering somewhat from the physics. In 2D drawing a mesh that follows the rigid body chain works well. In 3D you can make the rigid bodies bones of a skinned mesh.
     
    theANMATOR2b and QFSW like this.
  9. Hazneliel

    Hazneliel

    Joined:
    Nov 14, 2013
    Posts:
    305
    Hello, thanks everybody for your help. Following a few of your recommendations I managed to get a whip working.

    • Im using ubi rope to drive the rope mechanic
    • I also attached a rigid body to the tip of the whip, this makes the tip have some weight so it can create some momentum for the whip to follow that momentum.
    • Then I have a script in the tip that will know when the tip is moving faster enough to make sounds and check collisions.
    This is the final result:
     
  10. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    I was just going to suggest Obi then I saw that you used it (Ubi = Obi I guess?) :D Great tool. We use it for coppar wire simulation, not perfefct since copper wires are close to zero plastic and rope sims generally cant simulate that. But we are happy with the result



    Here is a guy that has doen a complete custom physics solution for his whip

    http://blog.runevision.com/2017/08/july-update-trials-and-triumphs-of.html

     
    mandisaw and theANMATOR2b like this.
  11. mohamedaraby

    mohamedaraby

    Joined:
    Feb 2, 2018
    Posts:
    1

    how can i do this wipe like rope ??