- Home /
Scale Tool/Handle breaks GL drawing?
Hi,
I'm working on an editor tool utilizing GL to highlight faces on a mesh through code like this:
foreach (List<int> selectedFace in selectedFaces) {
GL.Begin(GL.TRIANGLES);
GL.Color(new Color(1, 1, 0, 0.5f));
GL.Vertex(selObj.transform.TransformPoint(mesh.vertices[selectedFace[0]]));
GL.Vertex(selObj.transform.TransformPoint(mesh.vertices[selectedFace[1]]));
GL.Vertex(selObj.transform.TransformPoint(mesh.vertices[selectedFace[2]]));
GL.End();
}
This works fine when the move tool or rotate tool is actived. However if I change the active tool to scale tool, the highlighted triangle goes completely off. Same thing happened if I draw a custom Handles.ScaleHandle
. Only when the size of static Vector3 ScaleHandle(Vector3 scale, Vector3 position, Quaternion rotation, float size);
be 20.0f/3 will the GL triangles get drawn at correct position, and I have completely no clue why this happens.
Here's two screenshots illustrating this situation. Left is the correctly highlighted face and the right is the off one. The yellow triangles are drawn by GL function. Any one has experience with this situation? Thanks!
Your answer
Follow this Question
Related Questions
controlling scale of an object via the scale of another obect 0 Answers
auto scale camera error when upgrading unity4.3 into 4.5 0 Answers
How to make a localToWorld matrix for shader parameters? 1 Answer
gravity and scale issue 2 Answers
Keep line renderer width same on screen no matter camera distance 1 Answer