2.49b On mouseover I make line from an object to an associated “label” (font); I think I’d rather the line go from mouse position to the font, so user can better see where the line is pointing when one object semi-overlaps another (by user moving the mouse so it is still on the object but not at the center of the object where the line would otherwise get drawn to).
But mouse position is 2d, font position is 3d.
Is there a simple way to make drawline go from a 3d position to the mouse cursor?
(edit) Also, is there any way to make the line a little thicker?
I assume that you’re trying the Rasterizer.drawLine() function, which just draws a line of a single pixel between two 3D points in space. If that is not satisfactory, try using an actual object.
Make a cube with the center at the left-most edge, i.e. it’s just moved over, say, a Blender Unit. Then, use the obj.scaling property to scale the line to equal the distance to the object from the mouse position. For getting the mouse position, I believe you can do this with an invisible ‘grid’-like object and a Mouse Over sensor (you can get the mouse’s hit position).
To make your line thicker just draw more than one line. Figure out where to draw them with respect to your point to point co-ordinates. Then you can draw all kinds of styles of lines and arrows with thickness, color, borders etc.
Well, that was “fun”, sortof! At least I learned a little about a few more Blender buttons! For now I think I’ll stay with the single pixel thick line.
re: the grid, is there any way to make that invisible in the GE?
(edit) nevermind, found the invis button, it got…hidden! (ironic!)
As far as I can tell so far, that grid is mouseover sensed in my other script which draws the line. Not sure how/if I could reject that in one script and sense it in another?
You don’t have to reject it. If you’re testing a MouseOver sensor from the Grid object, you can connect it to other objects by selecting more than one, and you can test it in other scripts by simply polling the sensor like you do in the line drawing script.
You’re probably right, I must be confused; thing is, I hadn’t yet connected my grid sensor to a controller/script, because I started getting errors as one or two other mouse over sensors, from empty mesh, were sensing the grid, and my script code for them couldn’t handle that. That’s why I thought I would have to reject/ignore the grid object being sensed in those other scripts, so I put
if new and not new == objects[“OBGrid”] before/outside my draw a line from Suzanne to label, 'cause I think that’s where it was hiccupping.
But I’ll have to set it aside now for a while and get some rest and come back to it later.