motion tweeing

Started by
3 comments, last by PfhorSlayer 16 years, 8 months ago
I don't know the actual name but what I'm doing is to connect from motion "A" to motion "B". For example there are "walk" and "run" motion, First "walk" and by some input, motion chaged into "run". Because there is no "WalkAndRun"(^^) motion, I interpolated between "walk" and "run" by programming in real-time. I know it's concept is very similar to key frame interpolation. But I don't know how to interpolate two rotation keys. Because in some frame, interpolation should be calculated in short angle, but in other frame, it should be in large angle... Could anyone give some advice for me?
Advertisement
hey

I'm not sure exactly if you're wondering how to interpolate between 2 rotation matrices, or if your wondering how to determind the rate/speed of interpolation, or if you are just wondering how to interpolate between 2 different animations.

Anyhows, if you are wondering how to interpolate between 2 rotation matrices, then I would advise ya to look into Quaternions, and using them for Spherical Linear Interpolation (SLERP) on rotations. I can't really give you a brief on such things, as I think I'm yet to properly understand them. But, I can point you to some articles about them, see euclideanspace.com Quaternion Interpolation (SLERP) (this place has other pages about quaternions you should also explore), sacredsoftware.net - Quaternions, gpwiki.org - Using Quaternions to represent rotation, delphi3d.net - Quaternions, The Matrix and Quaternions FAQ, Rotations in Three Dimensions - Part Five: Quaternions, NeHe Lesson: Quaternion Camera Class. Sorry to overload you with all these, I can't remember which are best though :\. Note, I also noticed when looking at gpwiki.org and sacredsoftware.net recently, that oddly their invert functions differ, but are used in the same manner? Maybe an expert can explain this?

Otherwise, if you are trying to determind the rate/speed of interpolation, then a quite logical approch is to firstly define the amount of time/frames you want it to take, then figure the size of the angle, and base the interpolation rate/speed on this. For example, say you want it to take 30 frames to complete interpolation, and the angle between these 2 rotations is equal to PI radians (180 degrees), then your rate/speed of interpolation would be (PI/30)/PI.

Hmm, I'm not sure if this sorta thing is even needed, and what affect it has to gameplay or whatever.

Finally, if you are just trying to figure out how to interpolate between 2 different animations then what I do is have a Skeleton class, in which I can attach models and animation. Now for each joint of the skeleton, I use a pointer to the previous/base transformation matrix used for interpolation between keyframes, so even if I change animations the current base transformation matrix the interpolation originates from still points to that of the previous animations keyframe. So basically this makes interpolation independant of animation, if this makes sense.

cya

[Edited by - yosh64 on July 26, 2007 8:57:50 AM]
Just slightly off-topic, but I'll explain this...
Quote:Original post by yosh64
Note, I also noticed when looking at gpwiki.org and sacredsoftware.net recently, that oddly their invert functions differ, but are used in the same manner?
The gpwiki.org version is actually the conjugate of a quaternion defined as
q* = (q.w, -q.x, -q.y, -q.z)
The sacredsoftware.net version is the actual (multiplicative) inverse, which is
q-1 = q* / |q|2
where |q| is the quaternion norm (magnitude, length, whatever)
|q| = √(qq*) = √(q.w2 + q.x2 + q.y2 + q.z2)
For a unit quaternion, the norm is 1 so the conjugate and inverse end up being equal in this case. In the context of graphics programming, since we're almost always using unit quaternions, conjugate and inverse usually mean the same thing.

[Edited by - Kalidor on July 26, 2007 12:37:07 PM]
Thanks for your reply and sorry for my poor english.
What I mean by interpolation between two quaternion is that
sometimes two quaternion have to be interpolated in acute angle
and sometimes in obtuse angle between two motion.

I don't mean interpolation itself but how to decide which
angle should I take(acute or obtuse?)







Generally, you want to take the shortest angle (so, the acute one).

This topic is closed to new replies.

Advertisement