Bones - Skeletal and Pose Animations for jPCT/jPCT-AE > Bones

Bones joint rotate but mesh doesn`t update

<< < (2/8) > >>

raft:
yes unfortunately it's a problem because of jME Ogre loader which Bones uses. it only supports skeletons up to 255 joints. try reducing number of joints in your skeleton.

Carlos Mateo:
Ok, the problem is that Im using the program MakeHuman to export the model, and it has all these joints. Is the any possibility to increment the maximun number of joint in the jME loader?

raft:
it's in my todo list, but honestly I dont know when. possibly not in a near future. if you would like to do it yourself, be my guest. Bones.zip contains relevant jME sources.

AGP:
Raft, do you actually have a to-do list? If so, do you mind telling me what it is? Another importer (again, fbx would be a game-changer)? Maybe more joints per vertex?

Carlos Mateo:
Ok thanks....well finally I have created a reduced version of my model with 15 joints....the problem is still the same....I can see the movement of the skeleton within the skeletonDebugger but the meshes dont update... the code is the following::

--- Code: ---        SkeletonHelper skeletonHelper=new SkeletonHelper(human);
        Joint j=skeletonHelper.getJoint("Bone.003");;
        totalRad= (float) (totalRad+rad);
        targetJoint(skeletonHelper.pose, j.getIndex(), new SimpleVector(1, 0, 0), new SimpleVector(0, 0, totalRad), totalRad);
        skeletonHelper.pose.updateTransforms();
        skeletonDebugger.update(skeletonHelper.pose);
        human.applySkeletonPose();
        human.applyAnimation();

--- End code ---

Being targetJoint the method is took from one of the sample's bones:


--- Code: ---private void targetJoint(SkeletonPose pose, int jointIndex, SimpleVector bindPoseDirection,
                             SimpleVector targetPos, final float targetStrength) {

        final int parentIndex = pose.getSkeleton().getJoint(jointIndex).getParentIndex();

        // neckBindGlobalTransform is the neck bone -> model space transform. essentially, it is the world transform of
        // the neck bone in bind pose.
        final Matrix jointInverseBindPose = pose.getSkeleton().getJoint(jointIndex).getInverseBindPose();
        final Matrix jointBindPose = jointInverseBindPose.invert();

        // Get a vector representing forward direction in neck space, use inverse to take from world -> neck space.
        SimpleVector forwardDirection = new SimpleVector(bindPoseDirection);
        forwardDirection.rotate(jointInverseBindPose);

        // Get a vector representing a direction to target point in neck space.
        SimpleVector targetDirection = targetPos.calcSub(pose.getGlobal(jointIndex).getTranslation()).normalize();
        targetDirection.rotate(jointInverseBindPose);

        // Calculate a rotation to go from one direction to the other and set that rotation on a blank transform.
        Quaternion quat = new Quaternion();
        quat.fromVectorToVector(forwardDirection, targetDirection);
        quat.slerp(Quaternion.IDENTITY, quat, targetStrength);

        final Matrix subGlobal = quat.getRotationMatrix();

        // now remove the global/world transform of the neck's parent bone, leaving us with just the local transform of
        // neck + rotation.
        subGlobal.matMul(jointBindPose);
        subGlobal.matMul(pose.getSkeleton().getJoint(parentIndex).getInverseBindPose());

        // set that as the neck's transform
        pose.getLocal(jointIndex).setTo(subGlobal);
    }

--- End code ---

What am I doing wrong? :S

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version