Lemur8063

Good evening guys, I'm new to spine, I'm trying to make my character's hand follow the mouse, i used solutions from this thread http://ru.esotericsoftware.com/forum/Spine-Unity-Making-the-arm-follow-the-mouse-7856 but they don't work , also i looked at your example "4 Object Oriented Sample" from the package, hand rotates but not correctly, this example uses Ik Spine Pro, but i am using ESS, how to make it work in ESS, I will be grateful.
public class boneController : MonoBehaviour {

public SkeletonAnimation skeletonAnimation;

[SpineBone(dataField: "skeletonAnimation")]
public string boneName;
public Camera cam;

Bone bone;

void OnValidate () {
if (skeletonAnimation == null) skeletonAnimation = GetComponent<SkeletonAnimation>();
}

void Start () {
bone = skeletonAnimation.Skeleton.FindBone(boneName);
}

void Update () {
var mousePosition = Input.mousePosition;
var worldMousePosition = cam.ScreenToWorldPoint(mousePosition);
var skeletonSpacePoint = skeletonAnimation.transform.InverseTransformPoint(worldMousePosition);
skeletonSpacePoint.x *= skeletonAnimation.Skeleton.ScaleX;
skeletonSpacePoint.y *= skeletonAnimation.Skeleton.ScaleY;
bone.SetLocalPosition(skeletonSpacePoint);
}
}


---

I purchased Spine Pro
Lemur8063
  • Postovi: 1

Harald

Am I understanding you correctly that your issue has now been resolved after the purchase of Spine Pro? If not, please let us know what is causing troubles for you.
Avatar
Harald

Harri
  • Postovi: 3589


Natrag na Unity