x


3d Line Drawing in editor with z-sorting

Hi, I'm trying to draw 3d lines (helpers) in the editor window. It works with both Handles.DrawLine and Gizmos.DrawLine, except that in both cases the lines are drawn on top of the meshes geometry, without any z-sorting.

Does anybody knows how to draw lines with z-sorting enabled so that they get hidden by the level geometry if they are behind it?

Thanks

more ▼

asked Oct 07 '10 at 04:13 PM

Ben 14 gravatar image

Ben 14
448 7 8 18

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

I don't think you really can and have it only in the editor's scene view.

Gizmos, Handles and Debug drawing all takes place on top of regular rendering of the scene as overlays. There is no way that I can find to get them into the same rendering queue as the regular render of the scene.

To create objects that are rendered as part of the scene's normal render queue, they would either have to be GameObjects in your scene or you would have to provide specifications for their drawing. One way to specify objects to be drawn is Graphics.DrawMesh or DrawMeshNow. You could fiddle with the GL functions, but those are very likely not to give you what you want. Any objects created in the scene view this way will also be rendered in the game view and I have found no way to prevent them from showing up in both.

You might try looking into Editor.OnSceneGUI to get things to happen only in the scene view, but I am fairly certain that anything put there would be subject to the limitations of the above methods.

more ▼

answered Oct 07 '10 at 06:41 PM

skovacs1 gravatar image

skovacs1
10k 11 25 91

Thanks for the answer skovacs. I guess I can manage what I want through DrawMesh indeed; it's remarkably less convenient though :)

Oct 07 '10 at 07:31 PM Ben 14
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1675
x123
x65
x45
x38

asked: Oct 07 '10 at 04:13 PM

Seen: 2034 times

Last Updated: Oct 07 '10 at 04:13 PM