JonVarner Posted July 28, 2018 Share Posted July 28, 2018 Hey all, I am currently working on a project that has a mesh driven by joints. However, during the animation I need to be able to determine the actual real world position for one of the vertices. I have tried .getVerticesData(BABYLON.VertexBuffer.PositionKind, true) This gives me the position of the vertex(s) at its starting point and not where it actually is as it deforms. I also tried BABYLON.Vector3.TransformCoordinates(vertex, mesh.getWorldMatrix() This of course gave me the real world coordinates of the vertex at its starting point. Again not quite what I was after. So I guess I am hoping that someone can point me in the direction of finding the location of a vertex after it has been moved by a joint. Thanks. Quote Link to comment Share on other sites More sharing options...
Guest Posted July 30, 2018 Share Posted July 30, 2018 Hello! unfortunately (in your case) the bones are processed on GPU side to be fast! So you cannot get the real world value of a vertex directly unless you turn off the GPU processing. It is possible but it will consume more CPU. You can do it with mesh.computeBonesUsingShaders = false. In this case all the transformed values will be in getVerticesData(BABYLON.VertexBuffer.PositionKind, true) Quote Link to comment Share on other sites More sharing options...
adam Posted July 30, 2018 Share Posted July 30, 2018 If you don't need the exact vertex position, you might be able to use bone.getAbsolutePositionFromLocal. https://github.com/BabylonJS/Babylon.js/blob/master/src/Bones/babylon.bone.ts#L1045 Quote Link to comment Share on other sites More sharing options...
adam Posted July 31, 2018 Share Posted July 31, 2018 Here's an example: https://www.babylonjs-playground.com/#EG1J26#1 GameMonetize 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.