Dad72 Posted October 10, 2018 Share Posted October 10, 2018 Hello, I ask myself this question: sometimes our animate models are totally distorted and with the use of updatePoseMatrix () this solves the problem. My question is why some model updatePoseMatrix() it is not needed and others need it. What exactly is this function? What is she doing ? why some model do not need it? Is this a defect in our animations? Thank you for the clarification. It happens in users of my software asks me the question and I do not really know what to answer. So I'm asking the question here to be less stupid. Quote Link to comment Share on other sites More sharing options...
Guest Posted October 10, 2018 Share Posted October 10, 2018 This function will reset the pose matrix to the current mesh matrix. This will mostly depends upon the way you created the mesh in your DCC tool. Sometimes the pose matrix is wrong and needs to be updated. TLDR: The default mesh position should be equals to the pose position Dad72 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted October 10, 2018 Author Share Posted October 10, 2018 Ok, I understand better. Thank you. I just had a hard time understanding that: Quote The default mesh position should be equals to the pose position The pose position of what? skeleton? Quote Link to comment Share on other sites More sharing options...
Guest Posted October 10, 2018 Share Posted October 10, 2018 The initial pose of the mesh (the first frame) should be the same as the poseMatrix "En gros ton mesh doit etre exactement le meme a t=0 que la premiere frame d'animation du squelette" Quote Link to comment Share on other sites More sharing options...
Dad72 Posted October 10, 2018 Author Share Posted October 10, 2018 Ok, Merci beaucoup DK Quote Link to comment Share on other sites More sharing options...
Dad72 Posted October 11, 2018 Author Share Posted October 11, 2018 So is it possible to create a condition that verifies the pose of the matrix to that of the matrix of the current mesh. I've seen his functions : (but I'm not sure what to use.) if(mesh.getPoseMatrix() !== mesh.getWorldMatrix()) { mesh.updatePoseMatrix(BABYLON.Matrix.Identity()); } //OR if(mesh.getPoseMatrix() !== BABYLON.Matrix.Identity()) { mesh.updatePoseMatrix(BABYLON.Matrix.Identity()); } // OR if(mesh.getPoseMatrix() !== mesh.computeWorldMatrix()) { mesh.updatePoseMatrix(BABYLON.Matrix.Identity()); } Quote Link to comment Share on other sites More sharing options...
Guest Posted October 11, 2018 Share Posted October 11, 2018 if(!mesh.getPoseMatrix().isEquals(mesh.computeWorldMatrix())) { mesh.updatePoseMatrix(BABYLON.Matrix.Identity()); } This should work Quote Link to comment Share on other sites More sharing options...
Dad72 Posted October 11, 2018 Author Share Posted October 11, 2018 isEquals does not exist. but I try var pose = dude.getPoseMatrix().equals(dude.computeWorldMatrix()); it always returns false, even if it is true. because of values on -0 and other 0 so this returns false even if it is true. Quote Link to comment Share on other sites More sharing options...
Guest Posted October 11, 2018 Share Posted October 11, 2018 arg... so you may need to write your own equal function which will go through all the 16 cells Quote Link to comment Share on other sites More sharing options...
Dad72 Posted October 11, 2018 Author Share Posted October 11, 2018 Ok I see. I will do that. Thank you DK Quote Link to comment Share on other sites More sharing options...
Dad72 Posted October 11, 2018 Author Share Posted October 11, 2018 I have to create the function like that, I add all the sums and at the end they must be equal or different. Maybe we can do it differently, but like that, it works. I put my function here in case it interests someone. isPoseMatrixEqual(mesh) { let poseMatrix = 0; let computeMatrix = 0; for(let i = 0; i < mesh.getPoseMatrix().m.length; i++) { poseMatrix += Math.abs(mesh.getPoseMatrix().m[i]); } for(let i = 0; i < mesh.computeWorldMatrix().m.length; i++) { computeMatrix += Math.abs(mesh.computeWorldMatrix().m[i]); } if(poseMatrix === computeMatrix) return true; else return false; } 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.