Preparation for Setting Up Collision Detection
In the Cubism 3 SDK or later, all ArtMeshes can be specified as a collision detection.
However, it is preferable for the ArtMesh to be simple in shape to reduce the load.
Cubism 3 or later has a function to automatically create the ArtMesh for collision detection. Here is how to actually set it up.
Please refer to “Setting up collision detection” for how to set up collision detection in the SDK.
Set ArtMesh for Collision 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 “Edit Texture Atlas” for more information.
The ArtMesh for collision detection placed on the texture atlas is placed in the upper left corner.
Since the ArtMesh for collision detection is displayed in a very small form (16 x 16 px), care must be taken not to overlap with other ArtMeshes.
About the collision detection ID:
If you generate an ArtMesh from [Create ArtMesh for collision detection], the ID is automatically set to “HitArea.”
However, this does not mean that the ID name “HitArea” should always be used for the collision detection; it is just set for clarity.
There are no specific naming conventions for the IDs of ArtMeshes for collision detection, so please discuss the names with the developer depending on the environment in which they will be implemented.
However, if a model created with Cubism 3 has collision detection, the ID will be “HIT_AREA” even in Cubism 2.1.
In Cubism 2.1, there is a restriction on the ID of the collision detection, so the name needs to be changed.
For more information, please refer to “Models with Collision Detection”.
Notes for Handling Collision Detection with SDKs
To handle collision detection in the SDK, you need to name the ID of the mesh for collision 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” is used for collision detection and to switch facial expressions.
The mesh named “Body” is used to play back motions when the screen is tapped.
If the range of collision detections overlap, the “Head” process takes precedence.
Names other than those listed above can be used by customizing the SDK.
The collision 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 collision detection specified in Cubism will be the range of the collision detection in Unity, these rectangles may be taken as the range of the collision detection even outside of the collision detection area specified by Cubism.
This is also true for deformation by parameters, and also occurs when the ArtMesh for rectangular collision 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 get collision detection with the same shape as the ArtMesh.