By zorakirby
#45367 I think I figured out what the problem is, but I don't know how to fix it. I actually ended up getting the Bones rotating correctly. However, the vertices go off in weird directions. I spent a couple hours last night trying to get it working, but eventually I was too tired to keep trying, so I went to bed. Today, I was trying it again, and just now I had the realization that I think the vertices are rotating around the correct Bone locations, but using global rotations instead of local ones. For example, I have a bone rotating on its x axis as it also spins on its z axis . The vertices, on the other hand, instead orbit the bone around the global x axis, then orbit on the global z axis, giving the completely wrong location.

If you guys know how to fix this, it would be awesome, because this is practically the only thing that isn't working in the smd loader. I read something about "quarternions" maybe being related to rotating correctly, but then I searched it on wikipedia, and I was like, "huuuuh?" :?

Edit: I just realized that I don't think that even the bone movement is right. The bone that looks like it's working is only working because the parent bone's "tip" location is only moving over one axis, so in that case, global rotation is practically equal to local rotation.
User avatar
By MrMasochism
#45384 The issue is likely to be the order that rotations are applied. Try switching them around and see how that goes
By zorakirby
#45390
MrMasochism wrote:The issue is likely to be the order that rotations are applied. Try switching them around and see how that goes


If only it were that simple. I've tried numerous combinations, even making the rotation negative, with no success. I'm pretty much certain that the reason is that global rotation is being used when it should be local, because of the way the vertices move. I just finished javadoc'ing all the important stuff; if anyone has an idea, i could upload it. Otherwise, I'll just keep at it until it works
By zorakirby
#45439 Ok, I think I can actually figure this out. I searched up "lwjgl bone animation rotation" on google, and not only did I find some information that will solve this problem, I also found a topic on StackOverflow called "Importing 3D skeletal animations from .smd model". No Joke.
There are a number of Vector/Matrix related things I gotta do, and I've never really done, like, anything with matrices, but I just now got code working that creates a 4x4 "matrix view" of the Bone's location and rotation, and it was really easy. Expect the animation loader to be working later today (i do have to go to work in 1 hr, for 4 hours, so most likely not), tomorrow, or, at the latest(I can't guarantee it though, never know what problems I might run into) the day after.
User avatar
By MrMasochism
#45474 If you need a hand with it get in touch with me sometime when I'm home. I'm sure that paper I took on matrix algebra will come in handy
JOIN THE TEAM