Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Free .ms3d animated loader - need help with getting joint position/rotation


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 CyanPrime   Members   -  Reputation: 104

Like
0Likes
Like

Posted 08 July 2012 - 10:30 AM

I got a really cool gift for you! It's a simple to use animated model loader!
Here is the entire package you'll need to start your 3d animated modeled games today!
https://dl.dropbox.c...ointConnect.zip

Here is how to use it:
[source lang="java"]AnimatedModel model = new AnimatedModel([filename], [scale vector]); [/source]

Where [filename] is something like "C:\models\model.ms3d" and [scale vector] is a LWJGL Vector3f that re-sizes the model based on it's content.
For example to make a half width double height model you'd say
[source lang="java"][background=white]new Vector3f(0.5f, 2.0f, 1.0f)[/background][/source]

So that's that, and now you may all be wondering why I'm posting this in a help section? Well, you see. It's because I need a bit of help on a thing I'm trying to implement, where you can attach other models to joints of a master model (like master warrior is holding a sword in his left hand) what it boils down to is that I can't figure out how to get the accessory model to stay , or even get to the right place.

This is the code the accessory model uses to get it's position and rotation. It's in AnimatedModel.java
[source lang="java"] [background=white]public Vector3f[] getJointInfo(float frame, int jointID, float myYaw){ Vector3f[] jointInfo = new Vector3f[2]; jointInfo[0] = new Vector3f(0,0,0); jointInfo[1] = new Vector3f(0,0,0); advanceAnimation(frame, true); Matrix4f worldMatrix = new Matrix4f(); worldMatrix.load(fjm[jointID]); worldMatrix.invert(); worldMatrix.rotate((float) Math.toRadians(myYaw), new Vector3f(0,1,0)); VectorRotate(joints.get(jointID).pos, worldMatrix, jointInfo[0]); /*roll*/jointInfo[1].z = (float) Math.toDegrees(Math.atan2(worldMatrix.m10, worldMatrix.m00)); /*pitch*/jointInfo[1].x = (float) - Math.toDegrees(Math.asin(worldMatrix.m20)); /*yaw*/jointInfo[1].y = (float) Math.toDegrees(Math.atan2(worldMatrix.m01, worldMatrix.m22)); return jointInfo; } [/background] [/source]
So, if anyone wants to download the .ms3d model loader package and take a look at that method and help me figure out why it's not working it'd help out not only me, but everyone who decides to use this model loader.

Edited by CyanPrime, 08 July 2012 - 10:32 AM.


Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS