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

Pages: [1]
1
Bones / Bone length
« on: April 03, 2013, 11:30:16 pm »
Hi raft,

Is there a way to get the length of different bones in Bones API?


Ani

2
Hi raft,

I'm using JPCT-AE to display my ninja object on an Android phone. What I'm trying to do it to rotate different joints of the ninja. Because of the human structure people can rotate their neck around different axis (twist, bend, flexion and extension). But because all the rotations are with the same joint, I'm getting a weird problem. Once I have twisted the neck by some angle, and I'm trying to add some blending rotation the neck gets to it's original position and everything starts from scratch. I'm not sure what I'm doing wrong here, as I don't have a lot of experience in this field. Here is the section of performing rotation:

Code: [Select]
private void rotateJoint(SkeletonPose pose, int jointIndex, SimpleVector bindPoseDirection, float angle, final float targetStrength) {
   
        final int parentIndex = pose.getSkeleton().getJoint(jointIndex).getParentIndex();

        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);

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

        final Matrix subGlobal = quat.getRotationMatrix();
       
        subGlobal.matMul(jointBindPose);
        subGlobal.matMul(pose.getSkeleton().getJoint(parentIndex).getInverseBindPose());
       
        // set that as the neck's transform
        pose.getLocal(jointIndex).setTo(subGlobal);
    }




Ani

3
Bones / Pick a specific part of Ninja
« on: March 05, 2013, 08:13:45 pm »
Hi everybody,

I'm trying to rotate specific parts of Ninja object. So I need to determine the specific bone the user has picked by touching on some part of the screen. Using collision detection technique I can understand which object was picked, but that's not enough as this returns only the whole object (the Ninja).

So my question here is,  how to know which bone was selected by a touch event?


Thanks in advance!
Ani

4
Support / Pick a specific part of Ninja
« on: March 05, 2013, 05:38:42 pm »
Hi everybody,

I'm trying to rotate specific parts of Ninja object. So I need to determine the specific bone the user has picked by touching on some part of the screen. Using collision detection technique I can understand which object was picked, but that's not enough as this returns only the whole object (the Ninja).

So my question here is,  how to know which bone was selected by a touch event?


Thanks in advance!
Ani

Pages: [1]