I am having trouble with setting an attachment using Pixi.JS
When I do:
avatar = new PIXI.Spine("data/skeleton.json");
avatar.skeleton.findSlot("mouth").setAttachment("mondNEUTRAAL");
the default mouth attachment disappears, but the new attachment does not appear. I can see in the slot object that the attachment property is changed to "mondNEUTRAAL", but the data.attachmentName property is not changed.
Here is skeleton.json:
{
"bones":[
{
"name":"root",
"y":-9
},
{
"name":"bone3",
"parent":"root",
"length":279.6,
"x":1.42,
"y":1.05,
"rotation":91.98
},
{
"name":"bone2",
"parent":"bone3",
"length":260.42,
"x":267.82,
"y":85.88,
"rotation":178.06
}
],
"slots":[
{
"name":"right arm",
"bone":"bone2",
"attachment":"base_0001_Layer-1"
},
{
"name":"base",
"bone":"bone3",
"attachment":"base_0000_Layer-0"
},
{
"name":"eyes",
"bone":"bone3",
"attachment":"ogenNEUTRAAL"
},
{
"name":"mouth",
"bone":"bone3",
"attachment":"mondLACH"
}
],
"skins":{
"default":{
"base":{
"base_0000_Layer-0":{
"x":268.8,
"y":-31.83,
"rotation":-92.57,
"width":304,
"height":540
}
},
"eyes":{
"ogenLACH":{
"x":267.18,
"y":-21.31,
"rotation":-91.98,
"width":381,
"height":540
},
"ogenNEUTRAAL":{
"x":268.34,
"y":-23.07,
"rotation":-91.98,
"width":381,
"height":540
}
},
"mouth":{
"mondLACH":{
"x":268.95,
"y":-19.65,
"rotation":-91.98,
"width":381,
"height":540
},
"mondNEUTRAAL":{
"x":268.95,
"y":-19.65,
"rotation":-91.98,
"width":381,
"height":540
}
},
"right arm":{
"base_0001_Layer-1":{
"x":125.81,
"y":-6.05,
"rotation":90.45,
"width":58,
"height":274
}
}
}
},
"animations":{
"idling":{
"bones":{
"bone2":{
"rotate":[
{
"time":0,
"angle":0
},
{
"time":0.8333,
"angle":1.29
},
{
"time":1.6666,
"angle":0
}
],
"translate":[
{
"time":0,
"x":0,
"y":0,
"curve":"stepped"
},
{
"time":1.6666,
"x":0,
"y":0
}
],
"scale":[
{
"time":0,
"x":1,
"y":1,
"curve":"stepped"
},
{
"time":1.6666,
"x":1,
"y":1
}
]
},
"bone3":{
"rotate":[
{
"time":0,
"angle":0
},
{
"time":1.3333,
"angle":-0.4
},
{
"time":2.6666,
"angle":0
}
]
}
}
},
"laughing":{
"slots":{
"eyes":{
"attachment":[
{
"time":0,
"name":"ogenLACH"
},
{
"time":0.6666,
"name":"ogenNEUTRAAL"
}
]
}
}
}
}
}
Thanks!