Jump to content

Is it possible to add mousedown action on an element of a spine animation


mkit
 Share

Recommended Posts

If I just add a mousedown on my spine animations, I have noticed the hit area is a lot larger than necessary due to the animation data including additional elements. Possibly this is an error on behalf of the client who supplied the spine data.

 

Anyway I am trying to work with what I have been provided and would like to know if it is possible to add the mousedown listener to a "nested" element of the spine animation?

 

For example, I have an animation of some pillow in a bed lifting up to reveal an object below the pillows. The animation includes the entire bed but I only want the pillow area to be clickable.

 

So currently I have the following:

pillow.setInteractive(true);pillow.mousedown = function(mouseData){	     pillow.state.setAnimationByName("animation open", false);		}

I note that the element in the spine data that I actually just want to target is a slot called "Bedroom_Bed-Pillows"

 

I wondered if there is a way to add the listener to just this "object" rather than to the whole bed so that the hit area will not be so large and only cover the pillow area?

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...