trangiusarien

Hello,

I am considering buying Spine, but I want to try it out first. I 've used one of the example spine thingies and managed to get it into my Unity project and it seems to be working.

I need to be able to fully control the position of bones in code, and I've done this which seems to be working:
Bone targetBone = skeletonRenderer.skeleton.FindBone("left-ankle");
Vector2 boneLocalPosition = new Vector2(targetBone.x - 0.005f, targetBone.y);
targetBone.SetPosition(boneLocalPosition);
This was after doing a lot of research, browsing the forum and reading example code. However, I cannot find where in the API the Bone.SetPosition() is found (it's not here http://esotericsoftware.com/spine-api-reference#Bone-Methods), also I do not find it in the Bone.cs-file.

I find this a bit confusing, can anyone please tell me what is going on? :)
trangiusarien
Posts: 2

Pharan

Spine-Unity runtime is actually spine-unity built on top of the generic core spine-csharp runtime.

The spine-csharp core is agnostic to the engine that uses it. Unity uses it, XNA uses it.
So it doesn't have APIs for any of the Unity-specific types like UnityEngine.Vector2 or UnityEngine.Matrix4x4 or UnityEngine.Color or UnityEngine.Transform.

To make it friendlier to Unity users, we include a bunch of extension methods for the spine-csharp classes in spine-unity's SkeletonExtensions.cs to help you set colors, position according to different spaces, and other things with Unity's types.
spine-runtimes/SkeletonExtensions.cs at 3.6
User avatar
Pharan

Pharan
Posts: 4497

trangiusarien

Thank you very much for your reply,

I understand where to find the source code now. Is there aywhere I can find the Unity specific API reference, for the extension methods you describe? :)
trangiusarien
Posts: 2

Pharan

Currently, none. Sorry.
But those methods in SkeletonExtensions should all have IDE documentation in the code itself.
User avatar
Pharan

Pharan
Posts: 4497


Return to Runtimes