forked from LitStronger/live2d-moc3
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Live2dLoader/src/Live2dLoader.js
Lines 176 to 209 in 15424bc
| let po = this.model.toModelPosition(new PIXI.Point(offsetX, offsetY)), | |
| hitAreas; | |
| if (Object.keys(this.model.internalModel.hitAreas).length == 0) { | |
| hitAreas = this.hitTest(po.x, po.y); | |
| if (hitAreas.includes("TouchHead")) { | |
| this.model.internalModel.motionManager.startMotion( | |
| "", | |
| motionIndex[0] | |
| ); | |
| } else if (hitAreas.includes("TouchSpecial")) { | |
| this.model.internalModel.motionManager.startMotion( | |
| "", | |
| motionIndex[1] | |
| ); | |
| } else if (hitAreas.includes("TouchBody")) { | |
| this.model.internalModel.motionManager.startMotion( | |
| "", | |
| motionIndex[2] | |
| ); | |
| } else { | |
| this.model.internalModel.motionManager.startRandomMotion(""); | |
| } | |
| } else { | |
| hitAreas = this.model.internalModel.hitTest(po.x, po.y); | |
| if (hitAreas.includes("head") || hitAreas.includes("Head")) { | |
| this.model.expression(); | |
| this.model.motion("Tap"); | |
| } else if (hitAreas.includes("body") || hitAreas.includes("Body")) { | |
| this.model.motion("tap_body"); | |
| this.model.motion("Tap"); | |
| } else this.model.motion("Tap"); | |
| } | |
| console.log("Start motion: ", hitAreas.join(" / ")); |
这块的逻辑虽然并不乱, 但是不是很优雅灵活
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request