Rex's plugins for Construct2
  • Home
  • Map
  • Tutorial/Templates
  • News
  • About

rex_live2d

Plugin, ACE table, Discussion thread
Dependence: None

Introduction
Load and play Live2D object.

Usage
Sample capx
Load model
Call
"Action:Load" to load the resources of the model by a model.json file, which is exported by Live2D editor. Make sure the file path resources is correct, since C2 editor put all imported files into the root folder.
"Condition:On loaded successful" under "Model" category will be triggered while all resources loaded successful; otherwise "Condition:On loaded failed", get path of loaded failed files by "Expression:LoadedFailedFilePaths" which will be Joined by ";". "Condition:Is ready" will return true after model loaded successful.

Play motion
Call "Action:Start motion" to play a motion.
Get the name of current motion by "Expression:MotionName", or compare it by "Condition:Is motion playing".
On motion began
"Condition:On motion began", "Condition:On any motion began" will be triggered while start a new motion. Get the name of triggered motion by "Expression:TriggeredMotionName" under these conditions.
Get custom motion data
Get custom data of current motion by "Expression:MotionData".  There are 3 kinds of return value in this expression -
  • "Expression:MotionData" without any parameter, will return key-value pairs of current motion data in JSON string.
  • "Expression:MotionData( key )" , will return the value of a specific key, or return 0 if the key does not exist.
  • "Expression:MotionData( key, default_value )" , will return the value of a specific key, or return default value if the key does not exist.
Designer could read the sound name back by Expression:MotionData("sound", "") and play it for current motion. (see model.json file in sample capx)
On motion finished
"Condition:On motion finished", "Condition:On any motion finished" will be triggered while current motion is finished. Get the name of triggered motion by "Expression:TriggeredMotionName" under these conditions.
Idle motion
An idle motion will be played if no motion is played after previous motion had been finished. i.e. no "Action:Start motion" was called under "Condition:On motion finished", "Condition:On any motion finished".
The motion name of idle state could be set at "Idle motion" in properties table, or set by "Action:Set idle motion". Set idle motion name to "" could ignore this feature.

Set expression
Call "Action:Set expression" to set the expression.
Hit test
"Condition:Is inside area" will return true if a specific position is inside the part of model, the part name is defined in model.json file.
Sight
Call "Action:Look at" to turn the head, eyes, and body of current model look at a specific position.
Call "Action:Look front" to let the model look front like default pose.
Breathing
Set "Breathing" property to "Enable" or set by "Action:Breathing", to enable breathing motion of current model.
Lip sync
Sample capx
Set property "Lip sync" to "Enable", or set by "Action:Lip sync" to enable this feature (default is "disable") , then call "Action:Set lip sync value" to change the lip.

Set or add parameters
Sample capx
Call "Action:Set value" or "Action:Add to" to set or add parameters of model manually. These actions might change current behavior of motion.

Official save/load
This plugin does NOT support official save/load feature yet.

Appendix - content of model.json in sample capx

    

Create a free web site with Weebly
  • Home
  • Map
  • Tutorial/Templates
  • News
  • About