Sign in to follow this  
Dad72

About updatePoseMatrix ()

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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
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());
}
 
 

Share this post


Link to post
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.

Share this post


Link to post
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;		
}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.