GDCubismEffectHitArea

Desc

By placing it as a child element of GDCubismUserModel, you can handle the HitArea set on the Live2D model.

HitArea is composed of any Triangle. This allows you to express complex shapes, but in the GDCubismEffectHitArea class, it is treated as a box (Rect2) that contains the vertices that make up the Triagle.

If you want to determine on a Triangle basis, you can do so by using the get_detail function after receiving the hit_area_entered signal.

Properties

bool

monitoring

[default: true]

Methods

Dictionary

get_detail(model: GDCubismUserModel, id: String)

Vector2

get_target()

void

set_target(target: Vector2)

Signals

hit_area_entered(model: GDCubismUserModel, id: String)

Called when the HitArea of the Live2D model is set at the point specified by set_target.
The behavior changes as follows depending on the state of monitoring.

  • In case of true …​ It will not be called until set_target is removed from HitArea after it is called.

  • In case of false …​ It will be called any number of times while set_target is within HitArea.

hit_area_exited(model: GDCubismUserModel, id: String)

Called when set_target becomes outside the range of HitArea after hit_area_enterd is called.
This signal has a chance to be called after hit_area_enterd is called, regardless of the state of minitoring, and it is only called once.

Enumerations

Constants

Property Descriptions

bool monitoring [default: true]

Switches the behavior of the hit_area_enterd signal.

Method Descriptions

Dictionary get_detail(model: GDCubismUserModel, id: String)

You can get more detailed information at the time of hit_area_entered.
The information obtained has three types of states depending on the judgment result between the point specified by set_target and the mesh specified by id.

Dictopnary contains nothing

There is nothing at the place specified by set_target.

Dictopnary contains rect: Rect2

The place specified by set_target is within rect, but not within Triangle.

Dictopnary contains rect: Rect2 and vertices: Array

The place specified by set_target is within rect and within Triangle.

Vector2 get_target()

Gets the point specified by set_target.

void set_target(target: Vector2)

You can perform contact detection with HitArea and the specified coordinates.
Calling set_target once is considered a click.
Calling it continuously is considered a drag operation.