Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Tangomajom

Pages: [1]
1
Bones / Add child joint to existing skeleton at runtime
« on: January 18, 2017, 11:06:12 am »
Hi Raft,

After a long time I'm back again with an interesting question. :)

Is it possible to "extend" the skeleton of an Animated3D object with an extra child bone?

Let me explain the reason of this question:
As you may remember I'm working on a fitness application, and I have an animated Male who can show various exercises. The human body can move correctly thanks to JPCT and your library. :)
Now I would like to modify my code to let the human grab and lift objects (barbells, chains, kettlebells etc.).

Here is my plan:
1. create the movable objects in blender with only 1 bone, which affects the whole mesh.
2. export the objects with the ogre exporter (Just like I did with the Male body), and import the .bones file to my android project
3. after loading I would like to add the movable objects single bone to the Male body skeleton as a child of the hand bone.

If this is possible then I just need to animate only the human body, and the accessories will follow the linked bone.
Step 1 and 2 is easy, but with step 3 I need your help. Is it possible to connect the object like this way?

Thank you in advance,


2
Bones / Some bones from the skeleton are twisted
« on: November 01, 2016, 03:35:42 pm »
Hi Raft,

I would like to ask your help with a very tricky situation. I've created a model in Blender and I was able to load it to Android via the Ogre xml files and bones converter scripts. It works like charm.
Afterward I've tried to animate the bones individually from android to double check whether it has the same behaviour like in Blender. Most of the bones are moving as expected but looks like some of the bones are rotated and their relative axes are also mixed somehow.

For example if I'm rotating the clavickle bone around it's Y at Blender, the visual result on Android looks like when I rotated around it's X and vice versa. 

At first glance I thought the problem is with the different coordinate systems of Blender and JPCT, but if it's really the case, then why only just some of the bones are gone "mad"?

I think the problem is with the exported ogre xml. Unfortunately this forum denies any file which is bigger than 64kb, so I've uploaded it to my server slot: https://medev.hu/3d/MaleBody/MaleBody.rar .
Would be good if I can double check how the exported file look like, but I can't found any ogre xml importer or visualizer apps for Windows. 
I saw in your previous posts that you're using some kind of Ogre Visualizer app. Could you please give me the link for this app, and give me some info how to use it?

I would also appreciate if you can have a look at my attached files, maybe you can find something what I did not.


Thank you in advance,

3
Bones / Which matrix is the best to rotate a bone?
« on: April 19, 2016, 10:18:48 am »
Hi,

Maybe this sounds a bit stupid, but I can't find out by myself.
So I would like to apply an Euler rotation based animation to my imported rigged model. The animation in the Collada file is played correctly, but I would like to create the same animation programatically.

My idea is to create a quaternion from the original rotation of the bone, and then I'll use the Quaternion.rotateX/Y/Z methods, and then this modified quaternion will go to the JointChannel.
The only question is that how can I reach the current rotation matrix of the bone, to create the good quaternion from it.

I tried to use the SkeletonHelper.getBoneDirection(animatedJoint).getRotationMatrix(), and also the animatedObject.get(0).getSkeletonPose().getLocal(animatedJoint.getIndex()).getTranslation().getRotationMatrix(), and they inverts as well, but none of them produced the expected result.

Please give an advise.

Thanks in advance,

4
Bones / SkinAnimation not displaying on android
« on: March 26, 2016, 08:26:10 pm »
Hi Raft,

First of all sorry for my English. I try to do my best, but I'm not a professional. I'm also a beginer with 3D modelling, therefore I asked your help.

So the problem in nutshell:

I succesfully imported a rigged object from Blender to JPCT. I already find out how can I move and rotate the joints. The next step should be to create a skin animation.
Basicly I just would like to rotate the joints, so only the rotation quaternions will change in the keyframes. The translation and scale vectors don't need to be changed.
The results of my code is not what I expected. My character is still not moving.

Please have a look at to my code, possibly I'm not using your library right, or just missing some neccessary method call. 

This is how I apply the animation in the OnSurfaceChanged() method:
 
Code: [Select]
SkinClipSequence clipSeq = new SkinClipSequence(createSkinClip());
MaleBody.setSkinClipSequence(clipSeq);
MaleBody.animateSkin(0, 0);
MaleBody.applyAnimation();


And this is the createSkinClip method :

I'm just planning to rotate the shin of my character with 90 degrees and, then back to the init position.

Code: [Select]

private SkinClip createSkinClip() {

        List<JointChannel> jointChannels = new ArrayList<>();
        Joint shin = skeletonHelper.getJoint("shin.L");
        int animationLength = 3;

        SimpleVector jointStartDirection= skeletonHelper.getBoneDirection(shin);
        SimpleVector jointEndDirection =  new SimpleVector(jointStartDirection);
        jointEndDirection.rotateX((float) (Math.PI / 2));

        Quaternion quat = new Quaternion();
        quat.fromVectorToVector(jointStartDirection, jointStartDirection);
        Quaternion quat2 = new Quaternion();
        quat.fromVectorToVector(jointStartDirection,jointEndDirection);
        Quaternion quat3 = new Quaternion();
        quat.fromVectorToVector(jointEndDirection,jointStartDirection);

        float[] times = new float[animationLength];
        times[0] = 0.0f;
        times[1] = 1.0f;
        times[2] = 2.0f;
        SimpleVector[] translations = new SimpleVector[animationLength];
        translations[0] = shin.getBindPose().getTranslation();
        translations[1] = shin.getBindPose().getTranslation();
        translations[2] = shin.getBindPose().getTranslation();
        Quaternion[] rotations = new Quaternion[animationLength];
        rotations[0] = quat;
        rotations[1] = quat2;
        rotations[2] = quat3;
        SimpleVector[] scales = new SimpleVector[animationLength];
        scales[0] = new SimpleVector(1f,1f,1f);
        scales[1] = new SimpleVector(1f,1f,1f);
        scales[2] = new SimpleVector(1f,1f,1f);

        JointChannel chShin = new JointChannel(shin.getIndex(),times,translations,rotations,scales);

        jointChannels.add(chShin);

        SkinClip clip = new SkinClip(MaleBody.get(0).getSkeleton(),jointChannels);


        return clip;
    }

I added the animateSkin method to the OnDrawFrame() method, which runs at every frame.
My code look like this:

Code: [Select]
if(animtime >= 1.0f){
                animtime= 0.0f;
            }else{
                MaleBody.animateSkin(animtime,0);
                animtime+=0.01f;
            }

It is moving but it's runs on 7-10 fps, instead of 40-60 like without the animation. Am I used the animateSkin method wrong?


Thank you in advance,

Tamás O.

Pages: [1]