Preparation for setting up a hit decision

(Updated 04/09/2020)

In Cubism3 SDK or later, all ArtMeshes can be specified as a hit.
However, it is preferable for the ArtMesh to be simple in shape to reduce the load.

Cubism3 or later has a function to automatically create the ArtMesh for the hit detection.
Here is how to actually set it up.

Please refer to the following for how to set up hit detection in the SDK.
Bingo setting


Setup of ArtMesh for hit detection

In the [Menu] bar, click [Modeling] -> [ArtMesh] -> [Create artMesh for collision detection].


An empty ArtMesh is then created.
This ArtMesh does not differ from other ArtMeshes, so polygons can be edited or deformed with parameters.


Place the created ArtMesh where you want to set it.


If you have already created a texture atlas with the model at the time you create the empty ArtMesh, you must add this ArtMesh to it as well.
See the “Editing the Texture Atlas” page for more information.


The ArtMesh for the percussion placed on the texture atlas is placed in the upper left corner.

Since the ArtMesh for the hit judgment is displayed in a very small form (16 x 16px), care must be taken not to overlap with other ArtMeshes.


About the hit ID:
If you generate an ArtMesh from [Create artMesh for collision detection], the ID is automatically set to “HitArea”.
However, it does not mean that the ID name “HitArea” should always be used in the hit decision, it is just set for clarity.

There are no specific naming conventions for the IDs of ArtMeshes for judging hits, so please discuss the names with the developer depending on the environment in which they will be implemented.

However, if a model created with Cubism3 has a hit detection, the ID will be “HIT_AREA” even in Cubism2.1.
In Cubism 2.1, there is a restriction on the ID of the percussion, which needs to be changed.
For more information, please refer to the “Models with Bingo” page.



Cautions for handling hit judgments with SDKs

To handle hit detection in the SDK, you need to name the ID of the mesh for hit detection.
Names are set in Viewer for OW.


Enter the HitArea name in Viewer for OW and save.

The Cubism SDK, whether Unity, Native, or Web, uses two names: “Head” and “Body”.
The mesh named “Head” for the hit detection mesh is used to switch facial expressions.
The mesh named “Body” is used to play the motion for the tap.
If the range of hit judgments overlap, the “Head” process takes precedence.
Names other than those listed above can be used by customizing the SDK.

The hit detection obtained by the Cubism SDK is not necessarily the same shape as the ArtMesh.
(The same shape will be used for a rectangle that is completely horizontal and vertical to the canvas.)
Since the horizontal and vertical rectangles that surround the ArtMesh for the hit detection specified in Cubism will be the range of the hit detection in Unity,
it may be taken as a hit even outside of the hit specified by Cubism.
This is also true for deformation by parameters, and also occurs when the ArtMesh for rectangular hit detection is tilted by deformation.

However, the Unity version of the SDK allows you to change the accuracy of the range, and by changing the settings, you can also get a hit detection with the same shape as the ArtMesh.



© 2010 - 2022 Live2D Inc.