Sign in to follow this  
RobMaddison

Movement widget

Recommended Posts

I'm trying to draw my movement widget (standard 3 axis arrows that you see in most 3d apps) and I'm not sure how to handle the sizing of it.

I'm drawing it in my 'hud' screen layer which is where I draw my text and so it appears over the object it its centered on.

My question is how should I keep the widget at the same size regardless of how far away the object is that it is cenered on? My first thought was to 'fudge' the z component in the shader but that didn't seem to work.

The other option would be to draw the widget just in front of the camera but at the correct x and y position on the screen. Seems even more fudged though.

Any thoughts?

Thanks

Share this post


Link to post
Share on other sites
My attempt at positioning the widget in front of the camera kind of works ok. I basically just move the widget's position along the vector between the camera and the object by 2 units. The only issue I get is some minor distortion of the widget when it gets to the sides of the view - normal perspective distortion really, although I'd like to have less of that if possible.

I'm also drawing the arrows as actual meshes with some thickness to the rods so you end up with some aliasing issues too, I might investigate drawing lines as arrows but keeping the arrow heads as meshes.

Share this post


Link to post
Share on other sites

Why is the 3D widget dependent on the camera?

 

Compute the center of the context, and attach it as the parent of the object, using the center coordinates. The gizmo will exist in the world, and remain there until a new context has been selected, or the original is deselected. It's coordinate space will determine where the new object should exist.

The secondary benefit as a latter addition would be what blender does. Which allows you to control where the center is, for a different movement style

 

Or do you mean that it's size is changed when the camera gets closer or further?

In that case, did you try a percentile?

 

 

Example.

 

The default size of the gizmo is 1. and Shall be one as long as the camera is 5 unit away.

 

Should the camera's distance be greater or lesser than that, we find the threshold by how much.

if the distance is 100

Then 100/5.

 

That means we increase it's size by 20.

Edited by Tangletail

Share this post


Link to post
Share on other sites

Why is the 3D widget dependent on the camera?
 
Compute the center of the context, and attach it as the parent of the object, using the center coordinates. The gizmo will exist in the world, and remain there until a new context has been selected, or the original is deselected. It's coordinate space will determine where the new object should exist.

The secondary benefit as a latter addition would be what blender does. Which allows you to control where the center is, for a different movement style
 
Or do you mean that it's size is changed when the camera gets closer or further?
In that case, did you try a percentile?
 
 
Example.
 
The default size of the gizmo is 1. and Shall be one as long as the camera is 5 unit away.
 
Should the camera's distance be greater or lesser than that, we find the threshold by how much.
if the distance is 100
Then 100/5.
 
That means we increase it's size by 20.


Thanks for posting. It was more about keeping the widget at the same size regardless of how far away from the object you are. I accomplished this by just putting the widget at a fixed distance in front of the camera and aligning it between camera position and object position. The widgets are in a separate screen layer which is above the main scene layer so there's no issue with z or anything.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this