BangTao Posted March 30, 2017 Share Posted March 30, 2017 First,by this PG,I can use "BABYLON.Vector3.TransformCoordinatesToRef(tmpPos, mesh.getWorldMatrix(), sphere.position);" to get the rotated position of each vertex. http://www.babylonjs-playground.com/#GAY2K#0 Then,here is the BJS's "Dude.babylon" file,and i don't know how to get the right WorldMatrix after it's changed(see console.log() message).Am i missed some steps?or... http://www.babylonjs-playground.com/#1PN9TO#5 Thx! Quote Link to comment Share on other sites More sharing options...
adam Posted March 31, 2017 Share Posted March 31, 2017 To get the world matrix of a bone use getAbsoluteTransform and then multiply that by the world matrix of the mesh. Quote Link to comment Share on other sites More sharing options...
BangTao Posted March 31, 2017 Author Share Posted March 31, 2017 @adam Thx for replying like this? but... Quote Link to comment Share on other sites More sharing options...
adam Posted March 31, 2017 Share Posted March 31, 2017 http://www.babylonjs-playground.com/#1PN9TO#6 Quote Link to comment Share on other sites More sharing options...
BangTao Posted March 31, 2017 Author Share Posted March 31, 2017 I think it should keep changing?just likehttp://www.babylonjs-playground.com/#GAY2K#1(Line 56-57),so i can compute and get the childrenMesh's vertex position. skeletons[0].bones[0].getAbsoluteTransform().multiply(mesh.getWorldMatrix()) the output is always the same,seems i can't use this to get the vertex's position.. @adam Quote Link to comment Share on other sites More sharing options...
adam Posted March 31, 2017 Share Posted March 31, 2017 If I were you, I'd figure out what bone is close to the vertex you want to track and then use the code I showed you to transform a coordinate or use bone.getAbsolutePositionFromLocal() https://github.com/BabylonJS/Babylon.js/blob/master/src/Bones/babylon.bone.ts#L929 (I believe bones[0] is the root bone, so it isn't going to move that much.) Quote Link to comment Share on other sites More sharing options...
BangTao Posted March 31, 2017 Author Share Posted March 31, 2017 I've tried many timers ....I failed....i can't get the vertex corresponding to the bone,and every bones's matrix is still unchange..... I'm thinking that why we can see the animation,and erevy part is at the right place.but we just can't get the right position。 i'll keep investigation。 Any way,thx. @Wingnut @JohnK @adam @Deltakosh This is the most tough thing i've meet ever.No clue... 【---------------------------------------------------------------------------------------------------------------】 【....】 【Can i get the finall vertex's position at http://www.babylonjs-playground.com/#1PN9TO#7】 【---------------------------------------------------------------------------------------------------------------】 And why i can't search anything about "getAbsolutePositionFromLocal" at PlayGround,it has an error// Quote Link to comment Share on other sites More sharing options...
adam Posted March 31, 2017 Share Posted March 31, 2017 Here are 3 different ways to attach a mesh to a bone: http://www.babylonjs-playground.com/#1PN9TO#8 Quote Link to comment Share on other sites More sharing options...
BangTao Posted March 31, 2017 Author Share Posted March 31, 2017 i know the third method,.But i don't wanna attach mesh to bone... I wanna compute and get the vertex...How to use transformMatrices(Maybe i can use this to calculate the position..)?the result of "console.log(skeletons[0])": Now , i have the Initial status vertex's position information,i want to get the whole changed position at the "scene.registerBeforeRender(function(){...})". Just found another thing,but i don't know if it will help,which is convert skeletal animation to point caching...Anyone knows 3dsMax? Quote Link to comment Share on other sites More sharing options...
adam Posted March 31, 2017 Share Posted March 31, 2017 I through in that last attachToBone example because it isn't entirely clear to me what you're trying to do. Anyway, you need to get the vertex position relative to the bone it is being influenced by. You should do this before your animation starts. I'd use bone.getLocalPositionFromAbsolute using the world position of the vertex. Then you can use the code in the example above to track the vertex. It might not be perfect because vertices are often influenced by more than one bone. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted March 31, 2017 Share Posted March 31, 2017 Sorry to butt-in, but BT... is this needed for an "inverse kinematic" situation? An example would be... you need the fingertip of an avatar model... to land exactly on a button. With IK, you could "pull" the verts on the fingertip... TO the button (and it would look natural because of reverse transformation calcs). But I think you'd need to write your own IK stuff. SOME of this issue... might be solvable... using the old "parent and position a tiny invisible box" solution. But, even that tiny box... would need to be influenced by the same bones as the verts it surrounds. (or else it won't move with the skin). Up to 3 bone influencers on mobiles, and 4 otherwise. BT... mad scientist. Love it. 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.