• Editor
  • Binding a bone to a vertex in a mesh

I wonder if this could be done in any way, I have a mesh for a crystal and the animation I want to achieve is give it a 3D look effect, the face of the crystal will move to achieve this and there's some sparks and glows I'd like to add, that ideally would track vertexes in the mesh instead of me having to translate the bones controlling the sparks and glows to follow the mesh point manually

:clap:

Related Discussions
...

How about making transform constraints to the sparkle bones so that they mimic the bones influence of the vertex you want to follow?

Erikari wrote

How about making transform constraints to the sparkle bones so that they mimic the bones influence of the vertex you want to follow?

I also have the same problem.
I already have a project file in this topic but i don't know how to attach a bone to a vertex in mesh. Can u tell me ๐Ÿ™‚

How to turn your 2d character looking 3D

P/s: sorry for my bad english :$

5 days later

I've made a small project to display two ways of making an element follow two bones.
The first one is a bone that follows two different bones and stays in the correct place while the mesh deforms (the candle)
The second is the cream on top, which is made of many meshes that are binded to the two bones so that they follow it but without deforming. (very easy, it's just a bonus)

First we have the fact that the two bones match perfectly the corners of the mesh.
Then when we create the transform constraint we must remember:

  • to press "match" so that the current bone position won't be changed
  • the order of the constraints matters. The first one needs to be at 100
  • the second we create will be at 50, so both the bones will influence the translation by 50 and 50

here's a gif of how the bone was set up (please note I pressed ctrl+z after the first time I set translate to 100, to show that if you don't press match it moves the bone around)

here's the superquick result:

and here you can download the source files to look at the setting (:

Hi Erikari, I got stuck when I could not attach bones to mesh, I did something wrong?

Try to do it as follows:

  1. select the mesh
  2. select the "Weights" tool
  3. select "bind"
  4. pick the 3 bones
  5. select "bind" again to stop the binding
  6. select the single vertices to adjust the weights on them

Here's the complete guide: http://esotericsoftware.com/spine-weights

Thanks for going the extra mile and making the example Erika ๐Ÿ™‚

a year later

@Erikari I have every mesh binded to a bone called bind1. works perfectly in the editor. But in my game I move bind1 at runtime. I was expecting everything else to transform with it but it doesn't work.

Is there a way to achieve this?

Hello Bilal! Could you post gifs/screenshots of how your setup works in the editor and in unity?
How is only one bone controlling all the meshes? Are you trying to make something in 2.5D?

@Erikari Hi! thanks for the quick response.
Link to editor video
https://www.dropbox.com/s/tjanppxcgy1mhxu/spineAnimations.mov?dl=0

I use cocos2d-x
spineAnimation = SkeletonAnimation::createWithJsonFile("res/MainMenu/mainMenu.json","res/MainMenu/mainMenu.atlas");
this->addChild(spineAnimation,200);
Shared::rescale(spineAnimation, 0.75f);
spineAnimation->setPosition(winSize.width/2 , 0);
spineAnimation->setAnimation(0,"Entry",false);

bindBone = spSkeleton_findBone(spineAnimation->getSkeleton(), "bind1");

///on mousemove
//conceptually im doing this
mouseMove(){
bindBone->x = mouse->X;
bineBone->y = mouse->y;
}

I've tried calling update transforms etc. Is there anything that updates mesh transforms.


bind1 and bind 2 are bones that are binded to all the meshes.

Ok, I can't help you on the code side (I'll ask Badlogic!) but
What I could understand from the video is that you have a bone controlling part of a composition, then you move everything out.
When you say it doesn't work, is it because everything moves too much on mouse movement? I couldn't help but notice you're moving the bone in a restricted area. Maybe adjusting the weights so that they look good when the target bone is in each of the four corners might help. Otherwise, I'd need a clarification of the problem you experience at runtime.

@Erikari Thanks for the help. Yes I'll tone down the weights.

But the problem is when I move the bone(bind1) in editor it moves everything. But when I move it via code(even a small movement) it doesn't move the corresponding images. in fact it doesn't do anything.


I just realised that you thought that moving all objects was part via code... the video is all spine editor... let me make a full screen video for clarification


https://www.dropbox.com/s/uyhmlhu35pol94j/spineAnimations2.mov?dl=0

All animations work fine at code end.


Any solution to this? @Erikari @Badlogic


I added another bone(constraint bone) and made it a constraint on bind1.
When I move the constraint bone everything works!

Thanks

Hello Bilal!
(sorry for not answering earlier, here is early morning!) Badlogic was going to look into this today, but I'm glad you managed to find a solution on your own! My next step would have been to ask for the project because just from the video it was still hard to check for what could have gone wrong in the editor.
Great main screen by the way ๐Ÿ˜ƒ

Thanks @Erikari that means a lot ๐Ÿ˜ƒ.. I'll post the final result in showcase.