Kamola

Hi everyone,
I am working on a project using Phaser 3 and Spine.
I have a spine character that uses an atlas on preload.
I want to add more clothes atlases to my Spine object on runtime.
I couldn't find any example to do so anywhere,
How can I achieve this?
Kamola
  • Postovi: 5

Luke

Hello, this post from Nate (at the bottom of the forum post) may give you an idea of how you may accomplish your goal:
Swapping atlases at runtime?
Luke

Luke
  • Postovi: 118

Mario

Based on the Phaser 3 docs, who maintain the Spine integration, it's currently not possible to swap out the atlas of a skeleton. https://photonstorm.github.io/phaser3-docs/SpinePlugin.html

I'd propose to use Spine's skin feature: Skins - Spine User Guide

You can then pack all your different clothing options and any base attachments into a single atlas. At runtime, you can then set a combination of skins, i.e. based on a user's choice.

We have a sample for our soine-webgl runtime which does exactly that. https://github.com/EsotericSoftware/spine-runtimes/blob/4.0/spine-ts/spine-webgl/example/mix-and-match.html#L48
Avatar
Mario

Mario
  • Postovi: 3078

Kamola

Is it possible to add an atlas page to the existing atlas of the skeleton I created?
As I have an infinite number of clothes we create and I want to only load specific atlases the user has right now.
Everything is really dynamic.

I want to achieve something like this (Creating runtime skins but in Phaser 3 and not Unity)
spine-unity Mix and Match

If you guys have more information that could really help.

Right now the solution we had is to restart the scene with the atlases that I want to load but it seems to be pretty hacky.

I basically want to load another atlas and add it into my Skeleton as another atlasTexturePage.
Kamola
  • Postovi: 5

Mario

What I linked in my last post does exactly what spine-unity Mix and Match does. It creates a new custom skin that only picks the parts you want for the character from the atlas. You'll still only have a single atlas (with possibly multiple pages).
Avatar
Mario

Mario
  • Postovi: 3078


Natrag na Runtimes