Sign in to follow this  
alessiothecrazy@gmail.com

How can I make lift the leg of my rigged model?

Recommended Posts

Hi I am just a beginner in the 3d animation, my problem is this:I have a rigged human model and I have to lift his leg in this way. 0909-standing-leg-lift.gif (but just one leg and I don't care about the position of the arms) What I wanted to know is what kind of mathematics operation is this, is it a rotation??? thanks for your answers.( the start position of my model is the typical t pose )

Share this post


Link to post
Share on other sites

Two ways:

1. Standard way: take the modelling/animation tool (maja,max,blender...) of your choice and do the animation with this tool (there are tons of tutorials about animating rigged characters on the net).

2. Inverse Kinematics: you can use inverse kinematics to animation your model procedurally in code. This is used sometimes (99% of game animation are done within a professional animation tool) to e.g. lift the foot of a model, so that it always hit the ground. It is quite complex, therefor your best option is to get in touch with IK first (eg. google for inverse kinematics/ jacobian transformation etc.)

Share this post


Link to post
Share on other sites

what kind of mathematics operation is this, is it a rotation?

 

Yes, it's a rotation - in a hierarchical model, the upper leg bone is rotated in one direction and the lower leg bone is rotated in the opposite direction.

 

With regard to the math, it's commonly done with matrices. Take a look at this article for one way to implement animation on a skinned mesh with a hierarchical frame model (likely what you have), matrices and a shader.

Edited by Buckeye

Share this post


Link to post
Share on other sites

Hi I already have the angle ( I read that friom a sensor) , I am using jpct I already have the model I have the bindPose and the inverse bindPose of every bones, but I don't know how to use them. This is the code: (my problem is that I don't know how to use them and what they really do)

protected void rotazionecoscia()
        {
            Logger.log("rotazionebraccio"); 
            
            final Joint LUpperArm  = currentPose.getSkeleton().findJointByName("Vincent L Thigh");
            final Joint parentJoint = currentPose.getSkeleton().getJoint(LUpperArm.getParentIndex());
            
            final Matrix global= new Matrix(LUpperArm.getBindPose()); 
            float angle=(float)Math.toRadians(-90);
            global.matMul(parentJoint.getInverseBindPose());
            global.rotateY(angle);
            currentPose.getLocal(LUpperArm.getIndex()).setTo(global);
            currentPose.updateTransforms();
            skeletonDebugger.update(currentPose);
            modello.applySkeletonPose();
            modello.applyAnimation();
            
        }


This code I am using it works for the thigh but to be honest I don't Understand why it works can u explain me?

Thanks for your help :-D

Edited by Ale_gia

Share this post


Link to post
Share on other sites

First, I understand you're new to gamedev, and Welcome to the Community. However, please note: multiple posts ("cross-posting") with the same question are greatly discouraged. If you have a question, post a topic once. If one topic leads to another, as sometimes happens, post a link to redirect people (IF they're interested) to the other topic. One of the features of gamedev is the ability to search previous postings for questions and responses that may provide solutions to problems. Spreading discussions on a single issue among several topics and dozens of posts defeats the intent.

Share this post


Link to post
Share on other sites

Sorry ... sorry but we are two friends working on the same project and we posted at the same time, we are beginners in the 3d-programmation , we tested this code

	private void mulMatrixByInverse(Joint ref, Matrix mat) {
if (ref != null) {
mat.matMul(ref.getInverseBindPose());
}
}
	public void transformJointOnPivot(Joint joint, Matrix mat) {
Matrix bind = getJointBindMatrix(joint);
 
SimpleVector pos = bind.getTranslation();
 
// set the matrix to the origin
pos.scalarMul(-1);
bind.translate(pos);
 
// apply the transformation (this may translate it as well of course)
bind.matMul(mat);
 
// place it back where it was
pos.scalarMul(-1);
bind.translate(pos);
 
// TODO see if we need to do anything if the parent is not in its bind
// position
mulMatrixByInverse(getJoint(joint.getParentIndex()), bind);
pose.getLocal(getJointIndex(joint)).setTo(bind);
}
 

the code is taken from here https://gist.github.com/Chase-san/5253808 .

We don't understand why you have to multiplicate the bind with the  parent InverseBindPose 's joint bind Matrix, can u help us please?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this