Game Development Community

Go to a point in an animation

by David Horn · in Torque Game Engine · 04/21/2008 (5:50 pm) · 7 replies

Hello,

I have tried to search several things such as animation offset, animation skip to point, but i don't seem to have any luck. I'm not even sure this is possible.

What I'd like to do is go to a certain point in an animation. for instance, during a playthread call, I'd like to have the animation go directly to a point (for example) 10 seconds into the animation.

Is there a way to do this, or can anyone direct me to where I might be able to code it in the engine?

the practical app to this as an fyi is I want to have a submission hold in my game, but have the ability to interrupt the move and go to the ending portion of the animation. I can break the animation into two, but I'd like to avoid that if possible.

Thank you in advanced.

#1
04/22/2008 (8:56 am)
MShapeInstance->getPos( animThreadName );
mShapeInstance->setPos( animThreadName, setPos );
#2
04/22/2008 (10:16 am)
Hmm that's spiffy.

Guessing the position will be a float. 0.0 to 1.0?
#3
04/22/2008 (11:21 am)
Yes it is
#4
04/22/2008 (11:44 am)
Wow that's awesome... is that float a percentage?

so, for example, is this correct if I were to have the animation start 3/10 of the way into the animation?

playerInstanceName.playThread(0,"chokehold");
playerInstanceName.setPos("chokehold", 0.3);

Is that a script or do I need to make engine modifications such as this link?

http://www.garagegames.com/mg/forums/result.thread.php?qt=19651

Thank you
#5
04/22/2008 (12:16 pm)
1.0 is the end of the animation 0.0 is the the start, 0.5 is the middle.

What I posted is C++ code. If you are playing these animations on the action-animation-thread, you can use the script method "setActionThread", which has a position parameter - and if you are setting the position of an animation that is already playing you will need the pass the "force" parameter = true.

If you are playing the animation on a "script thread" then you would need to implement the ability to set its position, something like they are doing in that other thread.
#6
04/22/2008 (12:42 pm)
Oh, i see. Yes I am doing it via script, so I guess I'll look into that thread a bit more.
#7
04/22/2008 (12:44 pm)
Oh, i see. Yes I am doing it via script, so I guess I'll look into that thread a bit more.