Jump to content
  • Advertisement

Archived

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

Erestar

Get 'origin' after transformations are done on modelView matrix

This topic is 5307 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

Hey all, here''s the deal: I''ve got my spaceship flying around in 3d, and I have hardpoints on it that hold weapons. The hardpoint has a relative position about the spaceship it''s self. Rendering this is no problem, as after I''ve done the rotations for yaw, pitch, and roll, as well as the translations to put my ship in the right place for world coordinates (everything works fine there), all I do is loop through the hard points and renderer them (pushing and popping as needed) and everything works fine. Now, what I''d like to do is, while I''m rendering the ship, update the absolute position and direction of my hardpoints. At the point of rendering, I know they''re all in the right place, so if someone were to fire at that instant, the current position and direction of the hardpoint would be the initial position and direction of the lazer blast, or whatever. So, I can yank the modelview matrix out of openGL, but I''m not sure what the different elements represent. I read in another post that the fourth column represents the coordinates of the view, but outputting those values don''t seem right, as they''re all very small. Can anyone tell me the right way to think about this? Ere

Share this post


Link to post
Share on other sites
Advertisement
What you have is the transform of all points, rotation and translation, so you would multiply it by the origin since that is what you want, but since multiplying by 0 does nothing what i do ( i always use a large scale so it always looks right, not sure if it is right) is to multiply my matrix by 1,1,1 and then subtract 1,1,1 from the product, maybe someone on here would know the true way. In some way you''ll have to mulitply it by a vector, it maybe be 0,0,1 or something.

Share this post


Link to post
Share on other sites
quote:
Original post by Erestar
I read in another post that the fourth column represents the coordinates of the view, but outputting those values don''t seem right, as they''re all very small.


at which point are you looking at the modelview? also, any "camera" transformation is inverted, so what youre looking at isnt the point of view but the position of your object.

when you say 4th column, i hope you refer to indices 12-15?

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!