How do you animate your units?
Moderators: MR.D, Moderators
How do you animate your units?
So Ive been thinking of getting into animating some units, but find the whole COB thing a nightmare. I would like to know if anyone has found a more streamlined/visual approach to animation.
I also am baffled by all the movements being at constant speed. I would very much like if I could use constant acceleration instead of constant speed. I believe it could offer much more realistic animations.
Also, Im in search of some kind of method to rig the models; in my words, it would mean that I loaded up the model in 3d, and maybe set each joints degree of freedom and movement limits, and if I push and pull a peice, it would move the peices. Kind of like if i dragged the left foot forward, it would also adjust calf and thigh positions to accomodate for that movement.
Please offer any advice/experience you have in this matter.
I also am baffled by all the movements being at constant speed. I would very much like if I could use constant acceleration instead of constant speed. I believe it could offer much more realistic animations.
Also, Im in search of some kind of method to rig the models; in my words, it would mean that I loaded up the model in 3d, and maybe set each joints degree of freedom and movement limits, and if I push and pull a peice, it would move the peices. Kind of like if i dragged the left foot forward, it would also adjust calf and thigh positions to accomodate for that movement.
Please offer any advice/experience you have in this matter.
Re: How do you animate your units?
I animate by building the key frames in UpSpring, writing down all the numbers, then building the animation steps, then adjusting the timing via a constant. It's the easiest way, really- it rarely takes me more than an hour to do animations for simple stuff like a typical robot with walkcycle and firing animations.
You don't need to use constant speeds. What you need to do is to have constant time.
There's no rule saying that during a period of 1000, one rotation event can't take 700, another 300, for example. Using constant time means that you have a value that everything else is relative to, and lets you adjust timing for the whole sequence by changing just one number. If you want it to be faster, divide the constant in half, and now it's 350 / 150, for example.
Getting fancier than that is pretty expensive. The cheapest way to do true acceleration would probably be to build a series of move-now / sleeps and use smoothAnim interpolation, but I avoid it like the plague, because it's relatively expensive. Even fancier than that would be a ratcheted move-now that did true acceleration per gameframe with interpolation... you don't want to know how much that will cost, though. It's something you could use for a super-unit or a demo.
As for rigging, UpSpring is about as easy as you can get.
The rest of what you're talking about is building an IK system, and it'd just be a waste of time. If you build the keyframes, they're by-definition within your constraints; so your only trouble is if tweens go outside said contraints (happens frequently with double-twist rotations) and the only real cure for that is a tween key that fixes the issue (this happens all the time even in systems with IK btw).
You don't need to use constant speeds. What you need to do is to have constant time.
There's no rule saying that during a period of 1000, one rotation event can't take 700, another 300, for example. Using constant time means that you have a value that everything else is relative to, and lets you adjust timing for the whole sequence by changing just one number. If you want it to be faster, divide the constant in half, and now it's 350 / 150, for example.
Getting fancier than that is pretty expensive. The cheapest way to do true acceleration would probably be to build a series of move-now / sleeps and use smoothAnim interpolation, but I avoid it like the plague, because it's relatively expensive. Even fancier than that would be a ratcheted move-now that did true acceleration per gameframe with interpolation... you don't want to know how much that will cost, though. It's something you could use for a super-unit or a demo.
As for rigging, UpSpring is about as easy as you can get.
The rest of what you're talking about is building an IK system, and it'd just be a waste of time. If you build the keyframes, they're by-definition within your constraints; so your only trouble is if tweens go outside said contraints (happens frequently with double-twist rotations) and the only real cure for that is a tween key that fixes the issue (this happens all the time even in systems with IK btw).
Last edited by Argh on 28 Sep 2010, 10:19, edited 1 time in total.
-
- Posts: 916
- Joined: 27 Jun 2009, 01:32
Re: How do you animate your units?
I also fire up the model in Upspring, do the translations and rotations there and code those values into the script. In contrast to Argh I wouldn't call a walkcycle "simple stuff" and I especially object that this is the easiest way...
It's very hard to get a smooth and believable walk cycle. I spend most of the time looking at things ingame and then changing things as I see fit. That's why I think that there's a huge need for a WYSIWYG editor for animations where you immediately can play the "keyframes" you added in and are able to see if everything runs smooth and believable. The Blender export plugin might be such a solution but I have to admit I've never really tried it...
It's very hard to get a smooth and believable walk cycle. I spend most of the time looking at things ingame and then changing things as I see fit. That's why I think that there's a huge need for a WYSIWYG editor for animations where you immediately can play the "keyframes" you added in and are able to see if everything runs smooth and believable. The Blender export plugin might be such a solution but I have to admit I've never really tried it...
Re: How do you animate your units?
If you build animations with Lua, you can reload now, apparently, for testing in realtime.
But yes, compared to doing stuff with IK in a real editing suite, it's not fun.
But yes, compared to doing stuff with IK in a real editing suite, it's not fun.
-
- Posts: 916
- Joined: 27 Jun 2009, 01:32
Re: How do you animate your units?
Which is one of the biggest advantages over COB for me. It really saves a lot of time as you don't have to reload the mod...Argh wrote:If you build animations with Lua, you can reload now, apparently, for testing in realtime.
Re: How do you animate your units?
What I meant by constant speed is that joints have infinite acceleration. I would be fine with constant acceleration. But I guess Ill look into the engine and see what I can do.
I think Ill try the blender export plugin. But blender is notoriously hard to use.
I think Ill try the blender export plugin. But blender is notoriously hard to use.
Re: How do you animate your units?
Master-Athmos wrote:Which is one of the biggest advantages over COB for me. It really saves a lot of time as you don't have to reload the mod...Argh wrote:If you build animations with Lua, you can reload now, apparently, for testing in realtime.
docs/cmds.txt wrote:/reloadcob <unit_name>
Re: How do you animate your units?
reloading the cobs was kinda broken, some variables got messed up and stuff like that
Re: How do you animate your units?
Well, it works for me, but then I kept from TA the habit to initialize all my "static-var" in Create()
Re: How do you animate your units?
I apologize for the noobish question, but looking at the source didnt clear this up: Whats the difference between move and smoothmove?
Re: How do you animate your units?
This is purely a guess, but I'm guessing smoothmove has acceleration and deceleration at the ends.Beherith wrote:I apologize for the noobish question, but looking at the source didnt clear this up: Whats the difference between move and smoothmove?
Re: How do you animate your units?
smoothmove let the engine interpolate a series of move/turn now separated by sleeps into a smooth movement, that is, move/turn with speed.
I dislike smoothmove because, as every dumb algorithm trying to guess and correct input that's bad in the first place, it fails on anything a bit complex.
If you realised there can be a "speed" after "move/turn", then you do not need smoothmove.
I dislike smoothmove because, as every dumb algorithm trying to guess and correct input that's bad in the first place, it fails on anything a bit complex.
If you realised there can be a "speed" after "move/turn", then you do not need smoothmove.
Re: How do you animate your units?
Thanks zwzsg! That cleared it up, but now im wondering how acceleration can be passed to a move command...
Upon further inspection, it seems that both move and turn have acceleration parameters, but they are both passed as 0:
Code: Select all
void CUnitScript::TurnSmooth(int piece, int axis, float destination, int delta, int deltaTime)
{
if (!PieceExists(piece)) {
ShowScriptError("Invalid piecenumber");
return;
}
AnimInfo *ai = FindAnim(ATurn, piece, axis);
if (ai) {
if (!ai->interpolated) {
TurnNow(piece, axis, destination);
return;
}
}
// not sure the ClampRad() call is necessary here
float cur = ClampRad(pieces[piece]->rot[axis]);
float dist = streflop::fabsf(destination - cur);
int timeFactor = (1000 * 1000) / (deltaTime * deltaTime);
float speed = (dist * timeFactor) / delta;
Turn(piece, axis, speed, destination, true);
}
Code: Select all
void CUnitScript::Turn(int piece, int axis, float speed, float destination, bool interpolated)
{
AddAnim(ATurn, piece, axis, speed, destination, 0, interpolated);
}
void CUnitScript::Move(int piece, int axis, float speed, float destination, bool interpolated)
{
AddAnim(AMove, piece, axis, speed, destination, 0, interpolated);
}
Re: How do you animate your units?
You can't!Beherith wrote:im wondering how acceleration can be passed to a move command...
You can only have acceleration in spin (and even, it only works sometimes).
Re: How do you animate your units?
Wasnt there a branch with skeleton based animations? I think it was to be coded with lua with some high performance stuff done by engine (matrix operations).
Re: How do you animate your units?
So in essence, I would like the current constant speed infinite acceleration move to be replaceable with a varying speed constant acceleration move.
Re: How do you animate your units?
http://www.youtube.com/watch?v=JwL67-loGWULicho wrote:Wasnt there a branch with skeleton based animations? I think it was to be coded with lua with some high performance stuff done by engine (matrix operations).
posted in 2008
Re: How do you animate your units?
That may be possible with Lua as a new command. It's certainly not possible with BOS- if you want acceleration, you need to code it yourself.I would like the current constant speed infinite acceleration move to be replaceable with a varying speed constant acceleration move.
I don't really think you want this, though- the cost of it will be rather high per Piece, as that's going to be the equivalent of a move --> speed command for every rotational Piece every gameframe. Faking it adequately with good keys is a lot easier and cheaper
Re: How do you animate your units?
Nobody should be coding new units in BOS unless theyre copy pasting 95% of the code to save time
Re: How do you animate your units?
i really wish spring had an IK animation system