Sign in to follow this  
uglybdavis

[HELP] Milkshape3D animation not rotating correctly

Recommended Posts

uglybdavis    1065

Hey guys.

 

I'm trying to follow the Real Soon Now guide to animating a Milkshape3D model. My code seems to be working in that the model is rendering correctly, and the animations seem to be translating the model in the world properly, however no joint is ever rotating. This is confusing me to no end....

 

I've refactored my code so many times, i've even tried to implement the animation code without following the tutorial, to no luck i always seem to come out with the same issue :(

 

If anyone could take a look and tell me if i'm doing something super wrong or what, i'd really appreciate that!

 

My current code:

http://pastebin.com/tdZYbtJh

Share this post


Link to post
Share on other sites
uglybdavis    1065

I had a thought, "Hey, maybe my quaternions are busted!" so i removed the quaternions and changed them to matrices. Same result!

 

Matrix BuildMatrix(const Vector& rot, const Vector& trans) {
    Matrix t = Matrix::Translation(trans.x, trans.y, trans.z);
    Matrix x = Matrix::AngleAxisRotation(rot.x, 1.0f, 0.0f, 0.0f);
    Matrix y = Matrix::AngleAxisRotation(rot.y, 0.0f, 1.0f, 0.0f);
    Matrix z = Matrix::AngleAxisRotation(rot.z, 0.0f, 0.0f, 1.0f);
    
    return t * (x * y * z);
}

Vector ToTranslation(float* f) {
    Vector v(f[0], f[1], f[2]);
    v.w = 1.0f;
    return v;
}

Vector ToRotation(float* f) {
    Vector v(f[0], f[1], f[2]);
    v.w = 0.0f;
    return v;
}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this