Talk:DrawLine

From Unify Community Wiki
Jump to: navigation, search

Script not working as intended

I have implemented this script (both the js and the cs versions) as is on a blank project and I'm having two issues with it:

  1. The first point should be the center of the screen, but as I move around my mouse, this point keep shifting to somewhere else in the screen;
  2. likewise with the point that should be under the mouse cursor: As I move around my mouse, it shifts the point by some huge margin.

I have set my camera to Ortographic projection, and moved it to (0,0,0) with rotation (0,0,0), and even then it didn't work. Tried also putting the MonoBehaviour script in an empty GameObject but still no dice. HardDiskD 05:39, 29 February 2012 (PST)


I experienced the same issue, and solved it by removing the GUIUtility.ScaleAroundPivot line and instead used the following code to draw the texture:
GUI.DrawTexture(new Rect(pointA.x, pointA.y, (pointB - pointA).magnitude, width), lineTex);
--Isaks 02:00, 29 March 2012 (PDT)
Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox