Add is-inside-bone-radius action.

This commit is contained in:
Davide Tantillo 2026-03-05 16:07:16 +01:00
parent 00cc386246
commit a3cda6ea79
5 changed files with 81 additions and 0 deletions

View File

@ -69,6 +69,30 @@
}
]
},
{
"id": "is-inside-bone-radius",
"scriptName": "IsInsideBoneRadius",
"isTrigger": false,
"params": [
{
"id": "x",
"type": "number"
},
{
"id": "y",
"type": "number"
},
{
"id": "bone-name",
"type": "string"
},
{
"id": "radius",
"type": "number",
"initial-value": 10
}
]
},
{
"id": "is-animation-playing",
"scriptName": "IsAnimationPlaying",

View File

@ -57,6 +57,9 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Cnds =
IsInsideSlot (this: SpineC3Instance, x: number, y: number, slotName: string) {
return this.isInsideSlot(x, y, slotName);
},
IsInsideBoneRadius (this: SpineC3Instance, x: number, y: number, boneName: string, radius: number) {
return this.isInsideBone(x, y, boneName, radius);
},
IsAnimationPlaying (this: SpineC3Instance, animationName: string, trackIndex: number) {
return this.isAnimationPlaying(animationName, trackIndex);
},

View File

@ -364,6 +364,14 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase {
return this.isPointInPolygon(vertices, hullLength, coords.x, coords.y);
}
public isInsideBone (x: number, y: number, boneName: string, radius: number) {
const bone = this.getBone(boneName);
if (!bone || !bone.active) return false;
const bonePos = this.matrix.boneToGame(bone);
return this.inRadius(x, y, bonePos.x, bonePos.y, radius);
}
public isAnimationPlaying (animationName: string, trackIndex: number) {
if (!this.state) return false;

View File

@ -157,6 +157,29 @@
}
}
},
"is-inside-bone-radius": {
"list-name": "Is point inside bone radius",
"display-text": "Is point ({0}, {1}) within {3} pixels of bone {2}",
"description": "Check if a point in world coordinates is within a specified radius of a bone's position",
"params": {
"x": {
"name": "X",
"desc": "X world coordinate"
},
"y": {
"name": "Y",
"desc": "Y world coordinate"
},
"bone-name": {
"name": "Bone name",
"desc": "Name of the bone to check"
},
"radius": {
"name": "Radius",
"desc": "Radius in pixels around the bone position"
}
}
},
"is-animation-playing": {
"list-name": "Is animation playing",
"display-text": "Is animation {0} playing on track {1}",

View File

@ -157,6 +157,29 @@
}
}
},
"is-inside-bone-radius": {
"list-name": "点是否在骨骼半径内",
"display-text": "点({0}, {1})是否在骨骼{2}的{3}像素范围内",
"description": "检查世界坐标中的点是否在骨骼位置的指定半径范围内",
"params": {
"x": {
"name": "X",
"desc": "X世界坐标"
},
"y": {
"name": "Y",
"desc": "Y世界坐标"
},
"bone-name": {
"name": "骨骼名称",
"desc": "要检查的骨骼名称"
},
"radius": {
"name": "半径",
"desc": "骨骼位置周围的半径(像素)"
}
}
},
"is-animation-playing": {
"list-name": "动画是否正在播放",
"display-text": "动画{0}是否在轨道{1}上播放",