fix for manual bone rotation issue affecting all cloned animated skel… #1759
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…etons that
Fix for this issue:
http://www.html5gamedevs.com/topic/28257-cloning-bones/
When an animation is played on a bone, the matrix from the animation key frame replaces the _matrix (localMatrix) of the bone.
When a skeleton is cloned, the animations of each of the bones are copied, but they still share keyframes. Since the animations share the same keyframes and the keyframe matrix replace the bone's localMatrix, the bones of a cloned skeleton end up sharing the same localMatrix when they play the same animation.
This PG compares bones of two cloned skeletons before and after animations are run:
http://www.babylonjs-playground.com/#1ZBQR3#5
This fix uses a setter to force the _matrix to copy the values to the localMatrix of the bone. As a result, the bone retains the original unique localMatrix.