Ulfheden Posted February 7, 2018 Share Posted February 7, 2018 Hi again, After having rigged in Blender I noticed that the parents of bones don't rotate accordingly. It works in this demo from the tutorial however, where translating the head makes the neck bone adjust accordingly (you can see it by enabling debugging mode and enabling the skeleton viewer): https://www.babylonjs-playground.com/#1BZJVJ#32 I just can't tell what's wrong with my skeleton. In my case, moving or rotating a parent makes its children move just like they should, but moving a child does not rotate/scale their parents like in that demo. I tried downloading that demo and using my custom Babylon.js file and so on with it, and it works like it should. However, using my skeleton/mesh instead of the Dude in the demo creates the same behavior as mentioned above (i.e. parents still don't rotate when their children move). So there must be something wrong with how I set up my skeleton in Blender, or maybe there's something wrong with the Blender exporter? Or is there, despite getting the same problem with the demo code, something in my code that I'm missing? Of course, I ahve verified that I don't get this behavior in Blender, so I suppose it has something to do with the interface between Blender and BabylonJS? I've attached a very light weight demo of it, with the code from the tutorial demo, as well as the Blender file. Thanks in advance! sample.rar skTest1.blend Quote Link to comment Share on other sites More sharing options...
Wingnut Posted February 8, 2018 Share Posted February 8, 2018 Hi Ulfie... sorry to hear you are having problems. One of our leading experts in Blender/exporting... @gryff... has been missing, lately. I sure hope he is OK. Another Blender God... and the lead contributor to our Blender exporter... is @JCPalmer. Perhaps he will visit and give some advice. I have almost zero experience with Blender/exporting, and maybe even less experience with skeleton rigs. Sorry. By chance, do you see a choice during export... something like a checkbox for "use Quaternions"? If so, I would set that to true/yes... but this is just a guess. Be sure to do forum search for keywords such as skeleton, bone, etc. Read read read, because rigs has been discussed pretty often... here in the forum. While reading, be patient. I'm sure someone smarter than I... will comment soon. Thx for providing the files. Don't forget to read the Blender forums, too. Quote Link to comment Share on other sites More sharing options...
Guest Posted February 8, 2018 Share Posted February 8, 2018 Perhaps @V!nc3r can also help Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted February 8, 2018 Share Posted February 8, 2018 (unfortunatly I'm not comfortable with armature things, after small look into, 'doesn't know what happend here) Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted February 8, 2018 Share Posted February 8, 2018 Ah, child bones are not supposed to affect their parents, just the opposite. If you translate "Duke's" head bone, then it is going to stretch the head from the body. If you wish the whole body to translate, this is not the way to do it. Looking at your skeleton, I think your problem may be "Bone.002" is seemingly a child of "Bone.001", yet its actual parent is "Bone". I cannot see why this would be a good idea. Quote Link to comment Share on other sites More sharing options...
Ulfheden Posted February 9, 2018 Author Share Posted February 9, 2018 Thanks for the response, everybody! Wingnut, there are no export options for Babylon, really. It just says "No Properties" where, for other formats, there'd be a bunch of settings specific to that format. 18 hours ago, JCPalmer said: Ah, child bones are not supposed to affect their parents, just the opposite. If you translate "Duke's" head bone, then it is going to stretch the head from the body. If you wish the whole body to translate, this is not the way to do it. Looking at your skeleton, I think your problem may be "Bone.002" is seemingly a child of "Bone.001", yet its actual parent is "Bone". I cannot see why this would be a good idea. Yeah, but that's what I'm wondering - in Dude's case, the neck is getting stretched, while in my case, the bones are just being detached and float away. What's the difference between the Dude's skeleton and mine there? In the Dude's case, isn't his head just a child of the neck, and this is supposed to mean that when you translate the head, the neck stretches as observed in the demo there? I don't think it is? In the Babylon file and the Blender file, every ith bone is a child of the i-1th bone, right (see the attached snippet from the Babylon file)? Or am I missing something? The reason that this is all an issue for me is that I want to be able to move a bone's end/tail in all directions. This is of course the same as rotating this bone, let's call it B, but I thought it would be easier to just move B's child and thus rotate it that way (the child not affecting the mesh at all). I could of course just figure out where B's end/tail is (which would be equal to where the child is) and then calculate how to rotate B accordingly... Or I guess Inverse Kinematics is really what I'm looking for. The reason that I tried to just translate the bone's children is because I'm used to how skeletons work in 3ds Max where you can rotate a bone by simply translating its children - it is restricted to keeping its scale/length and thus is forced to rotate without deforming itself. Maybe it's some built-in IK controller, really... In Blender and BabylonJS I guess I'll need to explicitly apply IK for this to work? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted February 12, 2018 Share Posted February 12, 2018 I was confused by the dotted line, but it was for the mesh, so your skeleton is parented correctly. It already has an IK constraint on Bone.001. If you wish to do IK, you can do it either in Blender or BJS, depending on your needs. If you wish animation exported, you would need to do it in Blender. In that case, any IK bones added, put '.ik' in the bone name, so you can check the exporter 'Ignore IK Bones' check. For live animation it WebGL, you will need to use the implementation in BJS. When I did this from a skeleton exported from Blender, I had to specify a bendAxis. I do not know if this is due to my skeleton, or Blender in general. See this topic for more. Ulfheden 1 Quote Link to comment Share on other sites More sharing options...
Ulfheden Posted February 12, 2018 Author Share Posted February 12, 2018 3 hours ago, JCPalmer said: I was confused by the dotted line, but it was for the mesh, so your skeleton is parented correctly. It already has an IK constraint on Bone.001. If you wish to do IK, you can do it either in Blender or BJS, depending on your needs. If you wish animation exported, you would need to do it in Blender. In that case, any IK bones added, put '.ik' in the bone name, so you can check the exporter 'Ignore IK Bones' check. For live animation it WebGL, you will need to use the implementation in BJS. When I did this from a skeleton exported from Blender, I had to specify a bendAxis. I do not know if this is due to my skeleton, or Blender in general. See this topic for more. Yeah, I was aiming to use IK to make it easier to control my character's jaw (I want to define the jaw's rotation by defining its endpoint position). I'll also need to program all animation within WebGL/BJS, so I'll need to set the IK relationship and all that within BJS. I've done that now, but the thing is that the entire skeleton is affected by the IK constraint, not just the jaw. In e.g. Blender, you can set the chain length, i.e. how many levels of bones above the bone to be affected by the IK relationship, but there's nothing in the Bone or BoneIKController classes that suggests there's such a thing in BJS. In the IK demo with the "Dude", only his arm bones are affected... why is that? It's not because of the animation anyway. How can I apply the IK relation to just one bone, and not its parents? I think I'll just use the BoneLookController in this case instead, since I only want to affect the jaw bone, but it'd still be very interesting to hear if there is a chain length property (I couldn't find one though) or equivalent, or how it could be "simulated". Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted February 13, 2018 Share Posted February 13, 2018 Chain length is 2 for BJS. For Blender it can be more, but it usually has bad results. Ulfheden 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.