2d line in 3d - small error

Blitz3D Forums/Blitz3D Programming/2d line in 3d - small error

Chroma(Posted 2006) [#1]
Can you spot what's wrong with this code? It draws the line fine on the X axis, but when I draw a line from 0,0,0, to 0,50,0...the line isn't straight up. It's angled towards the camera on the YZ axis.

Btw, my camera is rotated at 65,0,0 if that matters.

Function Line3D(x0#,y0#,z0#,x1#,y1#,z1#,camera)
	CameraProject(camera,x0#,y0#,z0#)
	xp# = ProjectedX#()
	yp# = ProjectedY#()
	CameraProject(camera,x1#,y1#,z1#)
	Line xp#,yp#,ProjectedX#(),ProjectedY#()
End Function



Stevie G(Posted 2006) [#2]
Nothing wrong with your code ... same as I use.

I think what your seeing is expected behavour when using a non-ortho camera. Basically, world coords 0,0,0 and 0,50,0 will not necessarily have the same viewport x coord. Position a sphere at each world coord and you'll see what I mean.

Other than that .. do you have a short working example?

Stevie


Bobysait(Posted 2006) [#3]
the FOV of the camera make the view a seems sherical.so a vertical line that is not just in front of the camera will seem to be oblic .

You can try CameraZoom YourCam ,2 that will flatten the view.


Chroma(Posted 2006) [#4]
CameraZoom of 2 worked perfectly. Thanks Boby.

@Stevie...I'm just setting the camera at 0,90,-60 and rotating it to 65,0,0. Then drawing the line from 0,0,0 to 0,50,0. And moving the camera along the X and Z axis. When I moved +Z is when the line would appear to not be straight.


Chroma(Posted 2006) [#5]
BTW, is there a way to do an isometric type view with the ortho type camera mode?

EDIT: Actually, I see the same thing happening in maplet! So if Marks app does it then it must be ok. :)