Dear Users,

Now, we are seeking users who can give us a hand with expertise to evolve our software more dynamically.
If you are willing to help us, we’d like you to make a registration for “Live2D Creators Circle” via the link below.
Designers, programmers, translators are especially welcomed so far.
(More detailed explanation will be given to you before we ask you to do tasks)

Using Hit Areas In Unity?

edited August 2015 in Archive
I would like to do a few things with hit areas in unity.

I'm using the scripts from SampleApp1.

I want to make the objects created with the DrawHitArea function visible in the editor (maybe as a gizmo?).
I want to be able to change their transform (position and scale) with an UpdateHitArea function for hit areas that move when a parameter changes.

My problem is that I don't know how to access the objects created with DrawHitArea and I don't know how to move the object to the new position of the hit area.
Are the created objects GameObjects or something else? How are they named when they are created?

Hoping someone can help :smile:


  • Hit Area on a Live2D model can only be edited on Modeler. In Modeler, Hit Area is made by placing a dummy invisible drawable object with a specific ID to be treated as a Hit Area in Unity. Therefore the only way to access Hit Area is to directly edit these objects in Modeler.

    For your reference, Hit Area settings are controlled in “hit_areas” of a model.json

    {"name":"head", "id":"D_REF.HEAD"},
    {"name":"body", "id":"D_REF.BODY"}
    => name is used to identify hit area in game (e.g. head, body)
    => id is used to identify corresponding drawable object’s ID (see photo).

    When a screen is tapped, the tapped coordinate values are passed to LAppModel.HitTest() to determine whether or not a Hit Area is tapped. It is determined programmatically as opposed to a new object being crated like Mesh Collider in Unity.

    Also note that in SampleApp1, Hit Area is determined with a dummy drawable object in rectangle. So if you with to design specific shapes for Hit Area object, you ought to obtain the coordinate values of the object and reflect it in your codes.

    You can also refer to this document:

  • Hi Tod!
    Thanks for the response.

    Sorry for the late reply. It seems that DrawHitArea can work to make hit areas visible but
    it slows everything down dramatically. Still good to have something that works for debugging purposes.
    I'll try write a DrawHitArea type function that draws gizmos instead, in case it might work better than 'DrawRect'.

    Thanks again!
Sign In or Register to comment.