So, as you suggested, we are using Spine for our 2D models and having great results.
We have an issue with our current project. I used the scripts in the Spine Plugin demo project. I forked it and imported our model and it works nice and beautiful: https://playcanvas.com/editor/scene/421408
Looks like alpha blending sorting issues, as parts are very very close to each other.
I assume you do need to use alpha blending? What if you use only Alpha Test and No blending?
So Dave has āpatch.jsā script: https://playcanvas.com/editor/code/371225/patch.js which adds some extra code to override some sorting behaviour.
It does some difference, but still, it is visible āswappingā right at the beginning, but then it does not appears. Perhaps @dave can help here.
It looks more like sheās wearing a paper bag in her head,
TBH I forgot to mention that I changed a line in playcanvas-spine.min, to set the texture as emissivemap (weāre avoiding using lights), I saw in github you changed that line in a previous version and thought it could help. Maybe I should change the blendmode in the same script.
everything should work ok; so when we launch it, faces dissapear, and even the bird, which isnāt switching animations (just an idle animation looping), suddenly āflickersā
It seems the bird dissapearing has something to do with the camera rotation⦠or at least it seems so. In the beggining I thought it was a problem with the animation, but messing a bit with the code, I found this line:
this.entity.spine.spine.priority = 1;
when I take that off, I can see all layers, but we return to the sorting problem. As yoy can see, now the eyes and the eyes animate correctly, but then we have,again, the same problem with layers.
Sorting of the components when using Spine is done based on this compare function in the plugin:
This uses the draw order (index) and the priority (user-defined) to sort all the mesh instances. If priority is 0 (the default) then it uses the regular distance squared algorithm as well which we use normally.
The draw order is setup in the spine tool, but only applies with in the same model. So you can use the priority to order separate characters in the scene.
Iām not very happy with the system, but it should work for you case. Iād suggest:
check the draw order for the face if that is part of the same model as the girl, looks like the draw order might be wrong.
check the priority value for the bird. Looks like it might be sorting behind the background?
This is assuming that these are actually sorting problems and not just missing assets/images that are becoming apparent when you set a new animation?
Iām going to have a look at this today or tomorrow. But Iāve just checked it now and bird and face seem to work? Did you manage to fix it or do I need to make changes to introduce the bug?
The bird issue had easy solution, basically, we had an object in the scene, (a plane with a material) that was ācollidingā with the object so it seems sometimes it affected the spine object. That had an easy solution
The faces and animations overlaping was a bit more messy, Iāll post some screenshots in a while (when the artist sends me), looks like a bug related with Spine. Until we didnāt hide every āmouthā and āeyesā in the setup mode, and animate it again, it didnāt work out.
By the way, @dave , is there a way of adjusting opacity to the Spine model? Iāve tried to access opacity from script but couldnāt achieve a thing.