-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Open
Description
Version
- Phaser Version: 4.0.0-rc.5
Description
If a spine game object is placed inside a container with .setFiltersForceComposite(true), it's position will be rendered wrong
Example Test Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="//cdn.jsdelivr.net/npm/[email protected]/dist/phaser.js"></script>
<script src="https://unpkg.com/@esotericsoftware/[email protected].*/dist/iife/spine-phaser-v4.min.js"></script>
<title>Spine Phaser Example</title>
</head>
<body>
</body>
<script>
class BasicExample extends Phaser.Scene {
preload() {
this.load.spineBinary("spineboy-data", "https://esotericsoftware.com/files/examples/4.2/spineboy/export/spineboy-pro.skel");
this.load.spineAtlas("spineboy-atlas", "https://esotericsoftware.com/files/examples/4.2/spineboy/export/spineboy-pma.atlas");
}
create() {
const allContainer = this.add.container(100, 100);
const container = new Phaser.GameObjects.Container(this);
allContainer.add(container);
const container2 = new Phaser.GameObjects.Container(this)
.enableFilters()
.setFiltersForceComposite(true);
allContainer.add(container2);
const spineContainer = new Phaser.GameObjects.Container(this, 300, 400).setScale(0.5);
spineContainer.add(new Phaser.GameObjects.Rectangle(this, 0, -300, 500, 500, 0xFF0000, 0.5));
const spine = this.add.spine(0, 0, `spineboy-data`, `spineboy-atlas`);
spineContainer.add(spine);
container.add(spineContainer);
this.time.delayedCall(2000, () => {
container2.add(spineContainer);
});
}
}
new Phaser.Game({
type: Phaser.WEBGL,
width: 800,
height: 600,
scene: [BasicExample],
plugins: {
scene: [
{
key: "spine.SpinePlugin",
plugin: spine.SpinePlugin,
mapping: "spine",
},
],
},
});
</script>
</html>
In the code above, if .setFiltersForceComposite(true) is not called on container2, or if allContainer is at position (0,0) then the spine will be rendered correctly
Metadata
Metadata
Assignees
Labels
No labels