27
2013
Editor Mesh Helper Gizmos

Started making a mesh helper editor script. Should be useful to see the mesh details easily..
Current features:
– Display selected object details (DrawGizmo)
– Draw green boxes on vertex locations (Handles.DotCap)
– Display vertex number and UV info (Handles.Label)
– Label position is affected by the normals (so that overlapping vertice labes go bit different directions)
– Draw triangles with blue lines (Handles.DrawPolyLine)
– Line positions are multiplied by 1.005f, so that the default wireframe doesnt block them..
– Display face normals (numbers and visual line)
– Hide back facing details (if wanted), works kind of.. (Access to editor camera position/rotation/etc: Camera.current , not sure if there is other ways..)
– Use CustomEditor, instead of trying to modify every selected object (see image#4)
– Snap to closest vertices (using kdree): Works, but positions in the tree are not yet updated after modifying vertices.. maybe it wouldnt need kdree at all.
– Vertex position editor : first version works, just need to add mesh update while dragging the vertices
TODO:
– Draw handles with vertex colors (if exists)
– Vertex color editor
– Total vertex count
– Different color/style for the label texts
– Pivot position editor
– Show original mesh outlines
– Undo functionality (i guess its done with this: Undo.SetSnapshotTarget)
– UV value editor
– normal value editor
– Flip normals tool
– Export Tools: Export as script (like mMesh)
– Save modified mesh
– Button to “Reset mesh to original”
– Show vertex distance from startpoint when dragging
– Show vertex position (local and world) when dragging
– Flip / Mirror, flips all mesh vertices
– Maybe later: Removing / adding vertices?
– Maybe later: Optimize mesh? Smoothen/relax vertices?
– DX11 stuff?
–
SNIPPETS:
// calculate triangle centroid (center of 3 points) // http://math.tutorvista.com/geometry/centroid.html Vector3 centroid = (vertexpos1+vertexpos2+vertexpos3)/3; // get mouse world position (without raycasting), inside void OnSceneGUI().. //huh that took couple hours to get it working..unity docs ><, althought it doesnt work in most cases still.. Ray r = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition); Vector3 worldPos = r.GetPoint(Vector3.Distance(r.origin,targetObj.position));
—
Image#2: Back facing labels are hidden (kind of)

—
Image#3: Explosion.. Some problems with Handles.PositionHandle and moving vertices.. Oh no, broke the default “cube” mesh completely, how to reset it? (*Restarting unity fixed it)

—
Image#4: Default transform compoment from the inspector went broke also.. local rotation is displayed like this:
*Solved: I had this code: [CustomEditor(typeof(Transform))], replaced it with: [CustomEditor(typeof(MyScriptNameHere))]

Related Posts
3 Comments + Add Comment
Leave a comment
Recent posts
- Favorites in PackageManager
- LudumDare59 : Signal
- Unity Editor: Tree Generator
- Leaf/Foliage Generator Tools (Runs in Browser)
- Testing Unity AI Beta
- Ways to Support UnityCoder Development
- Using UI Slider to Create 5-Star Rating Element
- Game Music Library For Unity (editor plugin)
- Fontastic : Easily Test Fonts in Unity Editor!
- GeoTiff Importer & Terrain Generator for Unity
- Create Baked DropShadow for UI images
- .JP2 Ortho Image Converter to PNG/JPG/TIFF
Recent Comments
- on Mesh Exploder (sources)
- on Sprite Sheet Flip Book Shader
- on Sprite Sheet Flip Book Shader
- on [Asset Store] PolygonCollider2D Optimizer
- on Trajectory Test Scene 2.0
- on Vector3 maths for dummies!
- on UnityHub 3.6.0: Remove Version Control & Cloud Dashboard columns
- on Using RenderDoc with Unity (graphics debugger)
Coin:
CUgDSbRqFcAumDSAcdKDvuXsw26VdkJe8C8WGUQHBAGS
An article by












Well, now there is this:
GameDraw FREE Edition – Create and modify assets in Unity
http://forum.unity3d.com/threads/176137-RELEASED-GameDraw-FREE-Edition-Create-and-modify-assets-in-Unity
and this,
Probuilder free edition,
http://www.probuilder3d.com/try-free-purchase-later/
Pro builder is definitely worth $71.25, Unity’s missing editor, fast and snappy
https://sites.google.com/site/terrymorgan1213/tutorials/pro-builder-unity-3d
Huhu.. seems like only way to get MouseEvents with : EditorWindow, is this undocumented code:
void OnEnable()
{
SceneView.onSceneGUIDelegate += SceneGUI;
}
void SceneGUI(SceneView sceneView)
{
Debug.log(Event.current.mousePosition);
}
http://answers.unity3d.com/questions/489738/get-mouse-events-with-editorwindow.html