Drawing lines in 3D space using mouse
I'm having a bit of trouble figuring out how to draw a line in 3D space.
What I want to do is allow the user to use their mouse to draw a line anywhere in the 3D space.
They would left-click, hold it, and drag the mouse, as they drag the mouse the line would follow the cursor
to where ever the new mouse position will be located.
when they release the mouse button, the line should be created.
here is a snippit of my codes:
I'm using OpenTK as a wrapper since I'm coding it in C#.
public static void MousePos(System.Drawing.Point pt)
Vector mousePosInit = sceneCamera.LevelToLocal(new Vector(pt.X, pt.Y, .01));
initialPosX = mousePosInit.X;
initialPosY = mousePosInit.Y;
public static void UpdatePos(System.Drawing.Point pt)
Vector mousePosFinal = sceneCamera.LevelToLocal(new Vector(pt.X, pt.Y, .01));
finalVectorX = mousePosFinal.X;
finalVectorY = mousePosFinal.Y;
public static void Render()
private static ISE.Scenes.Camera sceneCamera = SceneManager.CurrentCamera;
private static double initialPosX, initialPosY;
private static double finalVectorX, finalVectorY;
I also use Icarus Scene Engine 3 to do all the camera, and rendering work.
Thanks for all the help!