amo yeh Posted November 9, 2016 Share Posted November 9, 2016 Two questions I would like to ask for this great library. Here is a scene I made with 3ds max, I used biped and exported as animation, http://www.babylonjs-playground.com/#2AMWUJ#0 1. The model world position changes on this animation. I noticed that skeletonViewer is not following the animation position, is this correct or I missed something? 2. I used attachToBone to attach a box on the head, how to affect only the position and rotation but not scale on this box? Thanks any one who knows the above Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted November 9, 2016 Share Posted November 9, 2016 1. The model isn't technically changing world position. You have rotation & translation on the root bone. Apparently skeleton viewer does not take that into account. It is better to move & rotate the meshes as a separate animation. That way, the mesh'es permanent position is accurate. The skeleton viewer is just a developer tool. 2. Kind of an all or nothing thing. Quote Link to comment Share on other sites More sharing options...
adam Posted November 9, 2016 Share Posted November 9, 2016 I got it working here: http://www.babylonjs-playground.com/#2AMWUJ#4 but that change messes up the skeletonViewer with other models: http://www.babylonjs-playground.com/#1BZJVJ#24 I'll try to come up with a better fix tomorrow. edit: I agree with what JCP said about moving and rotating the mesh instead of the root bone. Quote Link to comment Share on other sites More sharing options...
adam Posted November 9, 2016 Share Posted November 9, 2016 One difference between the dancing model and dude is that needInitialSkinMatrix is set to true on the dancer. Quote Link to comment Share on other sites More sharing options...
amo yeh Posted November 10, 2016 Author Share Posted November 10, 2016 Thanks JCPalmer for pointing out the root bone concept. The scene we are making only contains static animation with people dancing around, I guess it is fine to move the root bone. I will keep this concept in mind for making interactive characters, since mesh position matters. Adam that was great response with the demo code, really appreciated for the help, I will dig some more on the needInitialSkinMatrix and see how that works.as for the attachToBone question, I guess I can always get the bone position and rotation and update my mesh manually? The version 2.5 Bone.getAbsolutePosition and other related function looks promising, will try it and see how that works. Quote Link to comment Share on other sites More sharing options...
adam Posted November 10, 2016 Share Posted November 10, 2016 I think I figured out a good fix for this: http://www.babylonjs-playground.com/#2AMWUJ#6 http://www.babylonjs-playground.com/#1BZJVJ#25 I'll submit a PR tomorrow or Friday. Quote Link to comment Share on other sites More sharing options...
adam Posted November 10, 2016 Share Posted November 10, 2016 15 minutes ago, amo yeh said: I guess I can always get the bone position and rotation and update my mesh manually? The version 2.5 Bone.getAbsolutePosition and other related function looks promising, will try it and see how that works. There currently isn't a getRotation function for bone. I can probably add that this weekend. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 10, 2016 Share Posted November 10, 2016 Fix merged and PG updated Quote Link to comment Share on other sites More sharing options...
amo yeh Posted November 24, 2016 Author Share Posted November 24, 2016 Thanks for the update, by the way I was able to use bone getAbsolutePosition() and getRotation() function to relocate the box without scaling here is the updated demo http://www.babylonjs-playground.com/#2AMWUJ#8 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 28, 2016 Share Posted November 28, 2016 Lovely! 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.