Total control of an animation
by Alejandro Lopez · in Technical Issues · 05/30/2008 (2:21 pm) · 5 replies
Is there any way to move the animation frame by frame, like manual update ? or how can i control the animation.
this is my idea , ..i want to move an arm (mesh model ) with the mouse, if i move the mouse forward , i move the arm forward, and same to backward. ( left and right just move the cam.)
any ideas?
is there any way to know if the animation is still playing ?
this is my idea , ..i want to move an arm (mesh model ) with the mouse, if i move the mouse forward , i move the arm forward, and same to backward. ( left and right just move the cam.)
any ideas?
is there any way to know if the animation is still playing ?
#2
There are other ways to do it, but they're going to be more complex (using physics for example, or inverse kinematics).
05/30/2008 (5:08 pm)
You can definitely do this with animations. The easiest way if you want up/down and left/right movement is to make two blend animations. One that has your arm going from 0 to 1 starting at left or right, and one for up and down. Then you figure out how much you've moved the mouse, and set the animation to the right position. So it basically requires you to figure out your rate of movement in each axis (1 per anim). Make the x axis movement on the mouse translate to left/right and y axis to up/down.There are other ways to do it, but they're going to be more complex (using physics for example, or inverse kinematics).
#3
06/01/2008 (9:04 am)
Yes, but is there something like playAnimation( frame , animation ) . i have searched in the manuals for the code, but nothing yet.
#4
Using the starter code found there, you can gain absolute control over an object's joints. Now, what you do with them is up to you.
06/01/2008 (10:15 am)
@Alejandro - Have a look at this thread: Procedural Bone Animation/Using the starter code found there, you can gain absolute control over an object's joints. Now, what you do with them is up to you.
#5
You can create a new TSThread* in your Player class for handling the forward/backward arm animation.
Then in Player::onAdd you need to set a the animation sequence on it.
Something like this...
To continually set the animations blend position based on some value (probably specified from input), you might want to do something like this in Player::updateAnimation
06/02/2008 (1:16 pm)
It looks like Alejandro is still a new user (create account Apr.30th) so I'm not so sure implementing a whole ik solver is really a good plan, especially when you can do it with just blend animations.You can create a new TSThread* in your Player class for handling the forward/backward arm animation.
Then in Player::onAdd you need to set a the animation sequence on it.
Something like this...
S32 seq = mShapeInstance->getShape()->findSequence( "punch" );
if ( seq != -1 )
{
mArmThread = mShapeInstance->addThread();
}To continually set the animations blend position based on some value (probably specified from input), you might want to do something like this in Player::updateAnimation
if ( mArmThread )
{
F32 pos; // .... 0.0f is the beginning 1.0 is the end of the animation
mShapeInstance->setPos( mArmThread, pos );
}
Torque Owner Tyler Slabinski