Search Unity

Question How do I make a simple 3D expanding ring/donut attack?

Discussion in 'Getting Started' started by G1m1NG-Sc1enT1st03, Feb 21, 2022.

  1. G1m1NG-Sc1enT1st03

    G1m1NG-Sc1enT1st03

    Joined:
    Aug 17, 2021
    Posts:
    11
    Hi, everyone. I want to make an enemy create an expanding ring that only damages the player at the ring's perimeter. The player can jump over the ring/donut to avoid taking damage. I have not used custom meshes before, so any and all advice for making this attack would be greatly appreciated.
     
  2. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,076
    Attaching some colliders/triggers to the ring mesh might work.
     
  3. Realspawn1

    Realspawn1

    Joined:
    Jun 8, 2015
    Posts:
    128
    Use a sprite of a ring that starts growing when placed give it a name tag like ring so the player can respond to it while all other stuff ignores it's. You can use a mesh for this as well as a mesh collider won't grow with the object you can add box colliders in the shape of the object that move with the object while it's growing.



    at my place you can find examples in magazines and in the script library.

    www.rp-interactive.nl
     
    Last edited: Mar 1, 2022
  4. pauls99

    pauls99

    Joined:
    Mar 1, 2022
    Posts:
    2
    You can use a mesh for this as well as a mesh collider won't grow with the object you can add box colliders in the shape of the object that move with the object while it's growing.

    _
     
  5. G1m1NG-Sc1enT1st03

    G1m1NG-Sc1enT1st03

    Joined:
    Aug 17, 2021
    Posts:
    11
    Thanks for the advice. I got the shape right with the Unity Course Library, though the mesh collider deals damage to my player even if they jump over the ring. I tried to access your link if it had an answer, but the link wouldn't work.

    Here are two screenshots of my progress. One shows the mesh renderer inside the Inspector, and another shows what the ring looks like. My player is the red capsule, for context. Any tips on how I could add some colliders that move with the ring while keeping the mesh collider? Or should I get rid of the mesh collider entirely? Shockwave help 1.PNG Shockwave help 2.PNG
     
  6. Realspawn1

    Realspawn1

    Joined:
    Jun 8, 2015
    Posts:
    128
    The link works now but i made the example for youtube. A mesh collider will only work when it is not moving or growing. So what you do is add box colliders to the ring and shape them so they cover parts of the ring. The player will collide with those instead of the ring itself.