Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Making an Enemy With a Chain Weapon

Discussion in 'Editor & General Support' started by Wilelle, Oct 18, 2015.

  1. Wilelle

    Wilelle

    Joined:
    Jun 16, 2015
    Posts:
    93
    I don't know if this is the right place to post this, so if this doesn't belong here I'm sorry.

    I'm making an enemy, a boss to be specific, that wields a large chain with a spiked ball. The chain is dynamic, and each link has a Rigidbody and a configurable joint connecting it to the next link. Now I want to make the enemy use this properly as a weapon. And that's hard.

    The problem is that physics objects, especially things like chains, are highly unpredictable in how they move. So when the enemy performs an attack animation, swinging the weapon over his head or swiping it across the ground in front of him, the weapon barely reacts. I tried to fix this by adding forces to the spiked ball's Rigidbody, but the results only became more unpredictable and it simply looks unnatural and ugly.

    Does anyone have ideas of how to make this work? I know that a chain weapon should preferably be done with pre-made animations and no physics, but I really want to make this work. If I do manage to make a physics-based chain weapon that works properly, I think the result will be so much better than otherwise. Better visually and gameplay-wise. So please, does anyone here have advice on what to do to make it work?
     
  2. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Have you ever wielded a chain based weapon? They are pretty hard to get right in real life too. Simply swinging a weapon over the head or sweeping it in front of you won't do much. Chain weapons are often characterised by being swung around in circles first to build up momentum before striking.

    Perhaps build a training rig where you can test different movement patterns and measure their effectiveness. Iterate on this to figure out the key parameters. Then adjust the key parameters until you have an effective weapon.
     
    Wilelle likes this.
  3. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,433
    Imho especially for a bossfight it would be beneficial to make it a premade animation. If it is random it will be hard and possibly frustrating for the player to dodge from attacks. It is a rather well established rule that bossmonsters have patterns which can be learned and attacks that can be dodged. I don't see how more randomness and unpredictable physics behaviour could make this more fun. If it was a weapon the player wields that might be different.
    My suggestion would be to try if you can get the chain to simulate properly in your animation software and export the baked animation to unity so that you have something that both fits your requirement of looking realistic and also is predictable enough to avoid player frustration.
     
    Kiwasi likes this.
  4. simplygamer

    simplygamer

    Joined:
    Oct 20, 2015
    Posts:
    5
    oh man i love chain weapons. i have no idea how the physics works.. but all the best on figuring it out!! ;)
     
    Wilelle likes this.
  5. Not_Sure

    Not_Sure

    Joined:
    Dec 13, 2011
    Posts:
    3,541
    Yeah, that just sounds like a nightmare. A nightmare on the CPU. A nightmare to design. And a nightmare to implement effectively.

    I think animations are the way to go.

    IDK, maybe try doing some motion capture of someone using a chain weapon?
     
  6. Wilelle

    Wilelle

    Joined:
    Jun 16, 2015
    Posts:
    93
    Okay, I think I got it now. I set the Fixed Timestep to a lower value in Project Settings, so now the chain behaves like a chain. Instead of glitching out or move unnaturally when the enemy swings it, it actually swings properly. Naturally it comes with the cost of lower performance, but at least right now it's not even noticeable.
     
    Xenoun and frosted like this.
  7. Xenoun

    Xenoun

    Joined:
    Sep 2, 2015
    Posts:
    201
    If it works it sounds great. I would think an easier way to accomplish it would just be through art and animations as mentioned above. I'd just picture the whole chain as essentially a whip/rope in that you have a centreline that guides the overall configuration and move the links through the animation as necessary.