Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Logodae

3D trig (?) problem...

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m working with bones in a 3D engine. I''d like to derive the endpoint of any given bone, based on the start point, the angle (or angles, really; it''s a vector), and the length. My dim and distant memories of various math classes make me feel like this is a relatively basic problem, but I can''t seem to figure out what to do. Given some time, sleep, and perusal of old text-books, I''m sure I''ll figure it out... but if there''s anyone who can just give me the answer off the top of their head, or even point me in the direction of a relevant online tutorial, I''d appreciate it.
"Sweet, peaceful eyelash spiders! Live in love by the ocean of my eyes!" - Jennifer Diane Reitz

Share this post


Link to post
Share on other sites
Advertisement
there is no single 'angle', you have 3 angles:
x angle, y angle, and z angle.

Generate a Y axis rotation matrix, an X axis rotation matrix, and a Z axis rotation matrix, and multiply them in this order:

(Y * X) * Z, then multiply the resulting matrix by the point to get the final endpoint.

EDIT: I partially take that back, because you can rotate about an arbitrary axis using a single angle. However, I firmly believe that in this case using matrix mathematics is much better. I can post the equation for rotation about an arbitrary axis if you want me to.

[edited by - Shadow12345 on February 6, 2004 1:13:51 PM]

Share this post


Link to post
Share on other sites
Edit: Although I couldn't get the method you described to work properly, I've found a way around the problem entirely.

Thank you for your help, regardless.


"Sweet, peaceful eyelash spiders! Live in love by the ocean of my eyes!" - Jennifer Diane Reitz


[edited by - Logodae on February 9, 2004 5:01:25 PM]

Share this post


Link to post
Share on other sites
Umm, well, it does work, that''s what I use, just make sure you check the following:

-Make sure you are using the matrices for the corrrect coordinate system you are using (OpenGL uses a right hand coordinate system I believe)
-Make sure you multiply the Y rotation matrix by the X rotation matrix, GET A RESULTING MATRIX, and then multiply the RESULTING matrix by the Z axis rotation matrix, to get the final matrix that represents the rotation about the X, Y and Z axes.
-Make sure you are multiplying the matrices together properly - the [row][column] element of the final matrix should be equal to the product between the row and column of the two matrices you are currently multiplying together, and in order to multiply two matrices together the number of columns of the second must equal the number of rows of the first matrix

That''s the only useful info I can think of that you might''ve done wrong.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!