Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detecting touch on specific part of the skeleton #40

Closed
aliHafizji opened this issue Apr 29, 2013 · 1 comment
Closed

Detecting touch on specific part of the skeleton #40

aliHafizji opened this issue Apr 29, 2013 · 1 comment

Comments

@aliHafizji
Copy link

I just started using Spine and ran into a few issues. I'm using cocos2d as my game engine.

  • Is there a way to detect touch on a specific part of the skeleton. For eg: If I wanted to detect if the touch was only on the torso or the head. How would I go about doing that?
  • Also is there a way to change the texture that is drawn on a bone at runtime. For eg If the user touches the torse change the texture to something else?
@NathanSweet
Copy link
Member

You can use RegionAttachment_updateQuad to get the vertices for a region attachment. You can then use a polygon-contains-point algorithm to determine if a point is inside the region attachment. You can iterate the slots on a skeleton or use the Skeleton_getAttachment* functions to get the region attachments. See CCSkeleton draw().

You can change the attachment using Skeleton_setAttachment.

FWIW, the forums are a better place for questions. :) The issue tracker is better for bugs and feature enhancements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants