# Fixed-length axis on screen?

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

## Recommended Posts

How can I draw a fixed-length axis in 3D? So, if I zoom the view in/out, the local axis should relatively remain the same length on the screen. I'm trying to project the axis points from 3D to 2D, then render the axis in 2D, but, I'm having a little trouble afterwards, especially when looking at the axis from straight on. The axis lines start to jump around.

##### Share on other sites
Project the start point from 3d to 2d.

Store the projected point, create a second point with the length you want to have when done.

Project the second point from 2d to 3d.

Draw the axis.

##### Share on other sites
Sorry, I don't understand? Why are you going back to 3D for the second point? In my first post, I don't mean I have to draw it in 3D. I can draw it in 2D or 3D. It just has to seem as if it exists in 3D.

Where does the second point come from?

##### Share on other sites
You can't go from 2d to 3d because you've lost your depth. Those coords would be useless to me.

Can someone post some pseudo code on how to draw a fixed-length orthonormal axis, independent of zoom?

##### Share on other sites
The second point comes from the 2d calculation. You take your first 2d point, add the wanted length in the wanted direction.

You still have your depth. Usually it will be inside .z, mapped between 0.0 and 1.0. Just use the same value when mapping back.

If it's ok to paint in 2d, then it's even easier. Just project to 2d and you're done.

Maybe the jumping is from some rounding errors?

##### Share on other sites
Quote:
 The second point comes from the 2d calculation. You take your first 2d point, add the wanted length in the wanted direction.

This doesn't work. My axis lines jump around because 2D has no depth. I should be able to rotate the view
so I can look down on an axis, so you will only see a point. Always drawing an axis at a fixed length in 2D won't work.

How to solve this problem, I don't know.

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 10
• 9
• 9
• 11
• 11
• ### Forum Statistics

• Total Topics
633682
• Total Posts
3013311
×

## Important Information

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!