Jump to content

animation serialization issue


satguru
 Share

Recommended Posts

animation get corrupted when serialized.

see

http://ssatguru.appspot.com/babylonjs/animtest/test.html

This is a simple scene  playing the dude walk animation.

clck save button to serialize the scene

click load button to load the serialized scene back in.

see what happens to the animation

see the html source for the code

 

 

 

Link to comment
Share on other sites

ok I think i figured it out

The following works for me

for (Skeleton skel : scene.skeletons){
	for (Bone bone : skel.bones){
		bone.updateMatrix(bone.getBaseMatrix());
	}
}

BaseMatrix seems to contain the Rest pose. So reset each bone in each skeleton to BaseMatrix

 

Link to comment
Share on other sites

I did see that . :)

Good to see explicit support for rest pose.

Unfortunately that did not help.

I think we are loosing the  baseMatrix  here

https://github.com/BabylonJS/Babylon.js/blob/master/src/Bones/babylon.bone.ts#L70

Little hard to reproduce this in playground, as we need to dispose of the scene, but I will try

Regards

Link to comment
Share on other sites

I did some more testing.

I found that if I change 

https://github.com/BabylonJS/Babylon.js/blob/master/src/Bones/babylon.bone.ts#L69

from

	public updateMatrix(matrix: Matrix): void {	
		this._baseMatrix = matrix.clone();

		this._skeleton._markAsDirty();

		this._updateDifferenceMatrix();
	}

to

	public updateMatrix(matrix: Matrix): void {	
		//this._baseMatrix = matrix.clone();
		this._matrix = matrix.clone();
		
		this._skeleton._markAsDirty();

		this._updateDifferenceMatrix();
	}

then it works. :D

The problem was that the local Matrix wasn't getting updated,

 

Link to comment
Share on other sites

I do not update current release but as this is an open source framework you can fix it on your side

We cannot have the same commitments as a paid project. There must be some drawbacks :)

 

This one is easy to fix and I understand your point but sometimes it changes a lot of things and I do not want to go into a full cyle of testing/regression checks/npm update/nuget updates/yeoman updates/cdn updates

 

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...