Notifications
Clear all

[Closed] polyline from mouse to object?

I’m trying to draw a polyline from the mouse position to an object position, I know these are essentially point2 and point3 coordinates, but I find all the viewport drawing methods and coversion of coordinate systems very confusing…

Help much appreciated.

2 Replies
 PEN

I believe that in the Max script help Bobo wrote a function that does the conversion from 3D space to 2D viewport space.

I’ve been looking through the help files but …it’s not helping.

As far as I can see polylines want point3 values, and the mouse.pos is a point2.

I can get my object position by using the gw.setTransform(Matrix3 1), so I can draw a line between 2 object easily, but how to draw a line between object and mouse?

I’m not sure what to do with the mouse … I’ve tired adding my own “z” value to the mouse point2, and using the h and w variants. Nothing seems right though.

do I have to cast a ray through the mouse or something like that?