Fix collision mask of rotated Spine objects (#6482)

- Fixes rotation of Spine objects in the editor.
This commit is contained in:
D8H
2024-03-27 16:35:55 +01:00
committed by GitHub
parent 8178595546
commit 7d8afef1ad
2 changed files with 21 additions and 0 deletions

View File

@@ -148,6 +148,9 @@ module.exports = {
this._instance.getX(),
this._instance.getY()
);
this._pixiObject.rotation = RenderedInstance.toRad(
this._instance.getAngle()
);
this.setAnimation(this._instance.getRawDoubleProperty('animation'));
@@ -188,6 +191,14 @@ module.exports = {
return -this._spineOriginOffsetY;
}
getCenterX() {
return this.getOriginX();
}
getCenterY() {
return this.getOriginY();
}
/**
* @param {number} index - animation index
*/

View File

@@ -124,6 +124,16 @@ namespace gdjs {
return this.getY() + originOffset.y;
}
getCenterX(): float {
const originOffset = this._renderer.getOriginOffset();
return -originOffset.x;
}
getCenterY(): float {
const originOffset = this._renderer.getOriginOffset();
return -originOffset.y;
}
onDestroyed(): void {
super.onDestroyed();
this._renderer.onDestroy();