# motion tweeing

This topic is 4156 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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?

##### Share on other sites
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]

##### Share on other sites
Just slightly off-topic, but I'll explain this...
Quote:
 Original post by yosh64Note, 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]

##### Share on other sites
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?)

##### Share on other sites
Generally, you want to take the shortest angle (so, the acute one).

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633728
• Total Posts
3013577
×