Jump to content
  • Advertisement
Sign in to follow this  
redeemer91

Draw a small 3D axis

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

Hi, I have a small 3D world, where only the camera moves in relation to the objects. I would like to draw a small axis in the corner of my screen, to represent the alignment of the camera to the world. I managed to get a 3D axis at the center, by drawing a small axis at 0, 0, 0 and then moving the camera there (keeping the same alignment), but the technique to move it to a corner seems to elude me. Any ideas? Thanks, - Sid

Share this post


Link to post
Share on other sites
Advertisement
Have you tried applying the same translation transforms that you apply on the camera (plus an offset). just not applying any rotations etc.

Share this post


Link to post
Share on other sites
One way would be to extract the rotational component from the world-view matrix and apply it to a small line-list mesh that's fixed in world-space with respect to the camera. If you can't do this (because of a variable FOV or something), you could keep the axes model in screen-space and project back to z=0 after rotating it.

The rotation matrix can be computed using D3DXMatrixDecompose, or by just identifying the fourth row & column then scalar-dividing by the cube-root of the resulting determinant.

Admiral

Share this post


Link to post
Share on other sites
@Admiral

This is what I had done, but now I am using a OGL implementation that does not allow me to get the current model view matrix. I think I'll have to plugin to all model view matrix modifications, do my own and finally keep only the rotations.

I was just hoping there is an easier method.

- Sid

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!