1. ## OK, then simple question about Quats

How can I create simpe animation, knife movement for example.
Firstly, I translate it to needed position, rotate it with 3quats, then I calculate how the end position should look like 1 trans +3 quats. Finally, I calculate difference final trans/quat-start trans/quat and every frame call trans/quat+diff*t
Is that right?

2. ## Re: OK, then simple question about Quats

animating along a path... or just simple linear or...?

3. ## Re: OK, then simple question about Quats

Preferably non-linear, it's called Cubic interploration, yes?

4. ## Re: OK, then simple question about Quats

why 3 quats? you should only need one. If you have a start orientation matrix and an end orientation matrix, convert them to quats, then you can interpolate from one to another, linearly or non linearly.

5. ## Re: OK, then simple question about Quats

btw, some quaternion interpolation code

Code :
```
bool Vector::Interpolate(const Vector&amp; V0, const Vector&amp; V1, float Fraction)
{
float OneMinusFraction = 1.0f - Fraction;
x = OneMinusFraction * V0.x + Fraction * V1.x;
y = OneMinusFraction * V0.y + Fraction * V1.y;
z = OneMinusFraction * V0.z + Fraction * V1.z;
}

bool Quaternion::Interpolate(const Quaternion &amp;Quat1,const Quaternion &amp;Quat2,float Fraction)
{
//--------------------------------------------------------------------------------
// There are two quaternions for each orientation, this will cause problems if we don't
// eliminate one (i.e. zero crossover problem), so see if quaternions are on opposite sides of a
// 4 dimensional hypersphere (the degenerate case) and if so, flip one to the otherside (same
// orientation but now no zero crossover problem)
//--------------------------------------------------------------------------------
Quaternion NormQuat2 = Quat2;							//Used to get rid of degenerate case

if ((Quat1.DotProduct(NormQuat2)) < 0.0f)
NormQuat2 *= -1.0f;									//See comment above

//--------------------------------------------------------------------------------
// The degenerate case has been removed, can now interpolate normally
//--------------------------------------------------------------------------------
V.Interpolate(Quat1.V, NormQuat2.V, Fraction);

R  = Quat1.R * Fraction;
R += NormQuat2.R * (1.0f - Fraction);

return Normalise();
}```

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•