Hi everyone,
I'm trying to get an application running in which I can drag bones around and pose a simple puppet in the browser - similar to the hoverboard example you have on the demo page. I've come across this forum thread: http://esotericsoftware.com/forum/How-to-make-a-joint-draggable-17294 and managed to get the example running locally. My (JS) coding skills intermediate at best, though, and I can't seem to get the code to accept anything else than the Spineboy demo (e.g. when I load a different JSON/atlas, it gives me an error that the variable state is not defined).
I assume the problem lies in this section here:
function loadingComplete() {
var atlasLoader = new spine.AtlasAttachmentLoader(assetManager.get("atlas1.atlas"));
var skeletonJson = new spine.SkeletonJson(atlasLoader);
var skeletonData = skeletonJson.readSkeletonData(assetManager.get("demos.json").spineboy);
skeleton = new spine.Skeleton(skeletonData);
state = new spine.AnimationState(new spine.AnimationStateData(skeleton.data));
state.setAnimation(0, "hoverboard", true);
where it reads the skeletonData. I've tried comparing it with the documentation, but everywhere else, the line just reads a JSON file by name, without any extra attributes like the .spineboy in assetManager.get("demos.json").spineboy. I think I would be able to define different control bones etc. on my own, but I am stuck with getting any other skeleton in.
So my question - is it even possible to fairly easily make the code accept another JSON file? If yes, how would I go about that? Happy for any hints!