Jump to content

About updatePoseMatrix ()


Dad72
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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"

Link to comment
Share on other sites

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());
}
 
 
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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;		
}

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...