adam Posted January 24, 2016 Share Posted January 24, 2016 Does anyone know how to get the global position of a bone? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted January 24, 2016 Share Posted January 24, 2016 Maybe: var scale = BABYLON.Vector3.Zero(); var rotation = new BABYLON.Quaternion(); var translation = BABYLON.Vector3.Zero(); bone.getAbsoluteMatrix().decompose(scale, rotation, translation); Translation might be your wanted position. adam 1 Quote Link to comment Share on other sites More sharing options...
adam Posted January 24, 2016 Author Share Posted January 24, 2016 That helped. I got the absolute matrix of the bone and then multiplied it by the world matrix of the mesh. Thanks! Quote Link to comment Share on other sites More sharing options...
adam Posted January 24, 2016 Author Share Posted January 24, 2016 Here is a non-allocating function to get the absolute matrix: Bone.prototype.getAbsoluteMatrixToRef = function (result) { var matrix = result; matrix.copyFrom(this._matrix); var parent = this._parent; while (parent) { matrix.multiplyToRef(parent.getLocalMatrix(), matrix); parent = parent.getParent(); } }; Quote Link to comment Share on other sites More sharing options...
adam Posted January 30, 2016 Author Share Posted January 30, 2016 Thanks @Deltakosh for your recent work on Bone._absoluteTransform ! https://github.com/BabylonJS/Babylon.js/commit/3fce20e8c99f414f3af93df26e59e1e14f15124a 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.