Animation speed based on object scale
by Konrad Kiss · 06/06/2009 (2:24 am) · 6 comments
I'm scaling player objects in my game to extremes - some are really small, scaled to half their size, but some tower above buildings. Even in a set of mobs that move as a group, I have animals / monsters that differ in look and size. These must look as if they maintain the same speed. On the other hand, how cool does it look for a huge monster to move slowly over the terrain? :)
Anyway here's a simple fix to have this feature:
in player.cpp find the following line:
and just before that, add the following:
Anyway here's a simple fix to have this feature:
in player.cpp find the following line:
mShapeInstance->setTimeScale(mActionAnimation.thread,
mActionAnimation.forward? scale: -scale);and just before that, add the following:
scale /= getScale().z;
About the author
Lead Developer at Bitgap Games (www.bitgap.com) currently working on Xenocell (www.xenocell.com) a massively multiplayer action strategy game based on Torque 3D technology.
#2
06/06/2009 (12:04 pm)
I agree :) I really like little snippets like this one. Since I'm doing some ->Torque3D porting, I'm going to share if I see something like this. I'm also hoping that people new to Torque will learn from this - hopefully more than from huge cut & paste resources.
#3
06/06/2009 (5:53 pm)
Awesome Konrad!
#4
nice tweak there Konrad!
06/07/2009 (1:59 pm)
uhm, man how big are that christmas sack of yours ;)nice tweak there Konrad!
#5
Some get scaled as much as 0.04 0.04 0.04 and others are only 0.5 0.5 0.5 and some dont need scaling at all.
is there any way to use this with that scenario or would I have to scale and re-export everything to a matching scale first?
09/19/2009 (11:55 am)
this looks like it will only work correctly if all your models start from the same scale. Don't think it would work for me as I have models from several diff projects that have to be rescaled to fit the current project.Some get scaled as much as 0.04 0.04 0.04 and others are only 0.5 0.5 0.5 and some dont need scaling at all.
is there any way to use this with that scenario or would I have to scale and re-export everything to a matching scale first?
#6
If you need to scale many or every object, I'd say you should scale static objects such as the terrain or buildings instead, or if that's not possible, I'd do a re-export instead of extremely scaling something up or down.
What matters for this resource is that the animation that's exported with the model plays at an optimal speed for an unscaled instance.
09/19/2009 (3:20 pm)
@Donald: The point of this resource for me was to keep my player objects animated while they keep a common speed without "moonwalking" - regardless of their size. If you need to scale many or every object, I'd say you should scale static objects such as the terrain or buildings instead, or if that's not possible, I'd do a re-export instead of extremely scaling something up or down.
What matters for this resource is that the animation that's exported with the model plays at an optimal speed for an unscaled instance.
Associate Michael Hall
Big Kid Games