Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

2d hit boxes advice needed please

Discussion in 'General Discussion' started by derkoi, Mar 10, 2013.

  1. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,252
    I've bought ex2d for a current project and was wondering how i'd use hitboxes with the animations for a future beat em up project i have in mind. Can it be done or do i need another package for this kind of thing? Anyone else doing something similar with 2d hitboxes?
     
  2. n0mad

    n0mad

    Joined:
    Jan 27, 2009
    Posts:
    3,732
    Last edited: Mar 11, 2013
  3. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,252
    Thanks but like you said, i don't think it'll work with a 2d animated sprite.
     
  4. n0mad

    n0mad

    Joined:
    Jan 27, 2009
    Posts:
    3,732
    Actually I posted these for the part where an Editor script extracts Unity anims to fixed data structures, so you can create hitBoxes from animCurves at any time ;-)
    It can work pretty well even with 2D hitboxes (which are just "slim" 3D bounds).
     
  5. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,252
    Ah cool. I was looking at the boxes on the FBX part. lol Thanks
     
  6. AndrewGrayGames

    AndrewGrayGames

    Joined:
    Nov 19, 2009
    Posts:
    3,821
    To use builtin box colliders as hitboxes, you can also check out the WIP programming thread. Im one ofy testbeds, I making heavy use of hitboxes, but I'm also animating them in conjunction with my sprites.
     
  7. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,252
    What thread? Can you post a link please?
     
  8. AndrewGrayGames

    AndrewGrayGames

    Joined:
    Nov 19, 2009
    Posts:
    3,821
    This entire thread is a good one to keep your eye on, but this links directly to my handy-dandy post.

    Pretty much, it's operating on a set of strings associated to n GameObjects (presumably, ones with a Box Collider and associated scripts). When told that the entity is in a given state (e.g Walk-Left), this system will apply that state's transformations to each 'hitbox'. When I have my Zelda 2 swordfighter in better shape, you'll be able to see first hand what I mean, but for now that should help with some of your issues.