From a3cda6ea797239d658307b9518653a3d8833736e Mon Sep 17 00:00:00 2001 From: Davide Tantillo Date: Thu, 5 Mar 2026 16:07:16 +0100 Subject: [PATCH] Add is-inside-bone-radius action. --- spine-ts/spine-construct3/src/aces.json | 24 +++++++++++++++++++ .../src/c3runtime/conditions.ts | 3 +++ .../src/c3runtime/instance.ts | 8 +++++++ spine-ts/spine-construct3/src/lang/en-US.json | 23 ++++++++++++++++++ spine-ts/spine-construct3/src/lang/zh-CN.json | 23 ++++++++++++++++++ 5 files changed, 81 insertions(+) diff --git a/spine-ts/spine-construct3/src/aces.json b/spine-ts/spine-construct3/src/aces.json index 6e686338e..12457536a 100644 --- a/spine-ts/spine-construct3/src/aces.json +++ b/spine-ts/spine-construct3/src/aces.json @@ -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", diff --git a/spine-ts/spine-construct3/src/c3runtime/conditions.ts b/spine-ts/spine-construct3/src/c3runtime/conditions.ts index e2bb84db2..26da420aa 100644 --- a/spine-ts/spine-construct3/src/c3runtime/conditions.ts +++ b/spine-ts/spine-construct3/src/c3runtime/conditions.ts @@ -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); }, diff --git a/spine-ts/spine-construct3/src/c3runtime/instance.ts b/spine-ts/spine-construct3/src/c3runtime/instance.ts index e796a3db9..24fcba001 100644 --- a/spine-ts/spine-construct3/src/c3runtime/instance.ts +++ b/spine-ts/spine-construct3/src/c3runtime/instance.ts @@ -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; diff --git a/spine-ts/spine-construct3/src/lang/en-US.json b/spine-ts/spine-construct3/src/lang/en-US.json index 318383661..9c62bbc09 100644 --- a/spine-ts/spine-construct3/src/lang/en-US.json +++ b/spine-ts/spine-construct3/src/lang/en-US.json @@ -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}", diff --git a/spine-ts/spine-construct3/src/lang/zh-CN.json b/spine-ts/spine-construct3/src/lang/zh-CN.json index 299d9e49f..e7d78ae30 100644 --- a/spine-ts/spine-construct3/src/lang/zh-CN.json +++ b/spine-ts/spine-construct3/src/lang/zh-CN.json @@ -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}上播放",