GDCubismEffectTargetPoint

Desc

By placing it as a child element of GDCubismUserModel, you can make the face and eyes look at the specified coordinates.

You need to pre-configure the Live2D model to use this element.

If you want to move the eyes to the position where you drag the mouse pointer on the screen, use the following code to update the current position to GDCubismEffectTargetPoint.

func _input(event):
    if event as InputEventMouseButton:
        pressed = event.is_pressed()

    if event as InputEventMouseMotion:
        if pressed == true:
            var calc_pos: Vector2 = $GDCubismUserModel.to_local(event.position) * Vector2(1, -1)
            $GDCubismUserModel/GDCubismEffectTargetPoint.set_target(calc_pos.normalized())
        else:
            $GDCubismUserModel/GDCubismEffectTargetPoint.set_target(Vector2.ZERO)

Properties

String

body_angle_x

[default: "ParamBodyAngleX"]

float

body_range

[default: 10.0]

String

eyes_ball_x

[default: "ParamEyeBallX"]

String

eyes_ball_y

[default: "ParamEyeBallX"]

float

eyes_range

[default: 1.0]

String

head_angle_x

[default: "ParamAngleX"]

String

head_angle_y

[default: "ParamAngleY"]

String

head_angle_z

[default: "ParamAngleZ"]

float

head_range

[default: 30.0]

Methods

Vector2

get_target()

void

set_target(target: Vector2)

Signals

Enumerations

Constants

Property Descriptions

String body_angle_x [default: "ParamBodyAngleX"]

Specifies the ID used to change the orientation of the body with set_target.

String body_range [default: 10.0]

Specifies how much to move the ID specified with body_angle_x.
The larger the value, the more sensitive the response, and if you specify 0.0, it will not respond.

String eyes_ball_x [default: "ParamEyeBallX"]

Specifies the ID used to change the line of sight (direction of the pupil) with set_target.

String eyes_ball_y [default: "ParamEyeBallX"]

Specifies the ID used to change the line of sight (direction of the pupil) with set_target.

String eyes_range [default: 1.0]

Specifies how much to move the ID specified with eyes_ball_x, eyes_ball_x.
The larger the value, the more sensitive the response, and if you specify 0.0, it will not respond.

String head_angle_x [default: "ParamHeadAngleX"]

Specifies the ID used to change the line of sight (direction of the pupil) with set_target.

String head_angle_y [default: "ParamHeadAngleY"]

Specifies the ID used to change the line of sight (direction of the pupil) with set_target.

String head_angle_z [default: "ParamHeadAngleZ"]

Specifies the ID used to change the line of sight (direction of the pupil) with set_target.

String head_range [default: 3.0]

Specifies how much to move the ID specified with head_angle_x, head_angle_y, head_angle_z.
The larger the value, the more sensitive it responds, and if you specify 0.0, it will not respond.

Method Descriptions

Vector2 get_target()

Gets the direction the Live2D model is facing.

void set_target(target: Vector2)

Sets the direction the Live2D model is facing.
The direction that can be set is in the range of -1.0 to 1.0 for both x and y.
If you pass a value that exceeds the range, it will be contained within the range.

The coordinates to specify are not the coordinates of the screen, but the range from the center of the Node where the texture is pasted.

  • x: 0.0, y: 0.0 Front

  • x: -1.0, y: 0.0 Screen left

  • x: 1.0, y: 0.0 Screen right

  • x: 0.0, y: -1.0 Screen bottom

  • x: 0.0, y: 1.0 Screen top