- Modifié
[3JS] Attach to Skeleton/Socket
I'd like to attach some text that we apply to a mesh generated at run time to a skeleton/socket that's animated in spine so we can update the texture of the mesh at run time.
I see ways to attach sprites/objects to skeletons for other run times but I'm not sure how to do this specifically for 3JS. Are there any links I'm missing to resources for this? It seems like scripts are involved for unity to do this but I can't find any for 3JS.
Thank you \o/
It depends on whether you want to simply draw something on top of the skeleton at a specific bome/slot location, or if what you draw should actually be inserted into the drawing order of the rendered attachments making up the skeleton.
For the first case, you can simply call skeletonMesh.skeleton.findBone("bonename").getWorldX()/getWorldY()
after you called skeletonMesh.update()
. This will give you 2D coordinates of the bone relative to the skeleton mesh position.
For the second case, things are quite a bit more complicated and there's nothing out of the box in the spine-threejs API for that. I'd have to put some effort in to provide something easy to use.
Awesome, I think this will get us started. I'll pass the info along. The goal is - if a bone transforms (move/scale/rotates) I'd like to be able to have the object attached to that be affected by those transforms in 3js.