A little shaky about the "revertToBind" in Bone

Hi, I'm confused about this method in Bone:


    public void revertToBind() {
        worldTranslation.set(bindMatrix.toTranslationVector());
        bindMatrix.toRotationQuat(worldRotation);
        worldRotation.normalize();

        Matrix3f rotMat = bindMatrix.toRotationMatrix();
        worldScale.set(rotMat.getRow(0).length(), rotMat.getRow(1).length(), rotMat.getRow(2).length());
        if (rotMat.determinant() < 0) worldScale.x = -worldScale.x;

        if (children != null)
            for (Spatial child : children) {
                if (child instanceof Bone)
                    ((Bone) child).revertToBind();
            }
    }



I'm assuming this is supposed to be called to revert the state of the skeleton back to it original loaded state.  But this seems to only restore the "world" vectors back.  So then the "local" vectors are still set to their animated values, and thus when you update and render the scene, the model is still in an animated pose.
(Sometimes)
I say this, because actually, one out of every 5 or so times I "revert" the model, it will in fact be in the original pose, BUT the entire model will be offset from it's original position and orientation.  Same code.  Same updateGeometricState() called.

The whole update system in jMonkey is beginning to get on my nerves.  If there were a simple and standard way of updating everything that needs to be updated every frame, why is this not documented?

I have several posts (none of which answered) about various hitches in the update mechanism, regarding camera targets and flickering, etc.

Could the framework of JME be made a bit more stable as far as scene graphs staying up to date?  I would hope so.

Anyways, if you have some info on the "reverting" of skeletons back to their original (un-animated) state, please reply.
Thanks

The revert to bind method was written for loading and saving purposes, so repeated use of it during application run is not something that was tested.  I don't think adding a setting of the locals at the end of that would hurt anything though (I've done some limited testing and looking at it and it looked ok.) 



Basically:


        localTranslation.set(worldTranslation);
        localRotation.set(worldRotation);
        localScale.set(worldScale);



As for your other gripe... :)  You've posted 4 times in about 24 hours (your other previous 2 posts, you answered yourself.)  Sorry if you have not had many responses yet.  You have this one at least.

Thanks for the reply.



I wasn’t trying to gripe.  But this IS the first response I’ve received so far :slight_smile:



Anyways, I tried adding in your code to revertToBind, and:







Can you describe the way that Skins animate?  I see both world and local vectors being used in various parts of the code flow, but this seems prone to errors.

Shouldn’t the world vectors only be updated by the updateWorldVectors method?

Do you call updateSkin after the revert to bind?

Yeah, actually it's called inside SkinNode.revertToBind.

Although this method also calls:

bindMatrix.loadIdentity();


So I'm thinking this isn't the way I want to go about doing what I'm trying to accomplish.

I'm looking into alternatives.