3D [SOLVED]Draw line

N

Ninnin

Guest
Hi all !
I'll probably ask a stupid question, but i can't make a function works...

I want to draw a line between 2 points in a 3D environnement.

A part of my function is here:
Code:
    d3d_transform_set_identity();
    draw_set_color(color);
    d3d_transform_add_rotation_y(-90); //place to 0,0,0
    var angleZ = point_direction(x, y, target.x, target.y);
    var angleY = point_direction(y, z, target.y, target.z);
    var angleX = point_direction(x, z, target.x, target.z);
    d3d_transform_add_rotation_z(angleZ);
    d3d_transform_add_rotation_x(angleX);
    d3d_transform_add_rotation_y(angleY);
    d3d_transform_add_translation(x,y,z);d3d_draw_cylinder(0,0,0,1,1,2000,-1,1,1,1,24);
    d3d_transform_set_identity();
Point of origin is x,y,z and target is ... the target point :p

This don't work, the lines (cylinders) are not pointed to the target.

Does anyone here has a function to make this works ? Thanks :)
 
3d drawing is pretty tricky, but there is something called "d3d_primitive_begin"

Code:
d3d_primitive_begin( );
draw_set_color( c_black );
d3d_vertex( x1, y1, z1 );
d3d_vertex( x2, y2, z2 );

// x1, y1, z1, x2, y2, z2 are your cordinate variables
// use them with whatever you want
 
N

Ninnin

Guest
Hi Azure Knight !
Thanks for this, it works ^^
But it's only a 1 px width, there's no equivalent to draw_line_width i think :-/
I'l try to draw multiple vertex with 1px difference between them.
 
Top