How do I draw a line between two 3d coordinates?
I can't try it here but I expect I figured it out (if it's wrong, please somebody say so):
SimpleVector p1 = Interact2D.project3D2D(camera, buffer, vertex1);
SimpleVector p2 = Interact2D.project3D2D(camera, buffer, vertex2);
graphicsInstance.drawLine(p1.x, p1.y, p2.x, p2.y);
No, first of all, I dont know if using the Graphics object works on openGl.
Then, simpleVector coordinates and position of vector are not in a relationship with the x and y of the screen. you can have a 800 x 600 screen resolution but inside your Worlc you can have more that that amount of points, so you may need get the projection of each of those 2 points on the screen and then you can use the X and Y to draw the line.
And yet it worked. Read the documentation before saying I'm wrong. I appreciate the attention, but you might want to read the code before criticising it.
Yeah it worked because you are getting the projection of the 3d on the screen with the interact 2d, your code did exactly what I suggested to project the 3d over the 2d.
The problem was not ignoring how to do it, but putting few attention on your code to notice you were right. Check what I wrote and you will se that is exactly what you did.
Quote from: "AGP"I can't try it here but I expect I figured it out (if it's wrong, please somebody say so):
SimpleVector p1 = Interact2D.project3D2D(camera, buffer, vertex1);
SimpleVector p2 = Interact2D.project3D2D(camera, buffer, vertex2);
graphicsInstance.drawLine(p1.x, p1.y, p2.x, p2.y);
I could have sworn that code was different the last time I looked:P
This code looks right though:).
wow people are nervous today :wink: