Ich war gerade bei ein Seil zu proggen...
Ich will das mit vertices machen, damit da auch struktur drauf kann.
Doch leider habe ich nur selten was mit vertices gemacht, und weiß daher auch nicht, wo das problem ist. Das Seil ist löchrich, und nur schwarz... eigentlich sollte da ja textur sein
Alles anzeigen
Zb. sieht das so aus:
ich wette ich habe irgendwas vergessen
MfG SDX
Ich will das mit vertices machen, damit da auch struktur drauf kann.
Doch leider habe ich nur selten was mit vertices gemacht, und weiß daher auch nicht, wo das problem ist. Das Seil ist löchrich, und nur schwarz... eigentlich sollte da ja textur sein

GML-Quellcode
- /*
- by SDX
- draw_rope_texture(x1,y1,x2,y2,lenght,width,prec,tex)
- prec: between 1 and 0.0001, smaller=better; higher=faster
- */
- var xxp, yyp, xx, yy, i, prec, x1, y1, x2, y2, l, p, prec, partlen, rot, tex;
- x1=argument
- y1=argument1
- x2=argument2
- y2=argument3
- w=argument4
- th=argument5
- prec=argument6
- tex=argument7
- partlen=w*prec
- p=path_add()
- path_add_point(p,x1,y1,1)
- if point_distance(x1,y1,x2,y2)<w path_add_point(p,(x1+x2)/2,w-point_distance(x1,y1,x2,y2)+(y1+y2)/2,1)
- path_add_point(p,x2,y2,1)
- path_set_closed(p,false)
- path_set_kind(p,1)
- i=0
- xxp=path_get_x(p,0)
- yyp=path_get_y(p,0)
- xx=path_get_x(p,0)
- yy=path_get_y(p,0)
- while (i<=1+prec){
- xxp=xx
- yyp=yy
- xx=path_get_x(p,i)
- yy=path_get_y(p,i)
- rot=point_direction(xx,yy,xxp,yyp)
- //hier wirds interressant
- draw_primitive_begin_texture(pr_trianglefan,tex);
- draw_vertex_texture(xx+lengthdir_x(partlen/2,rot)+lengthdir_x(th/2,rot-90),
- yy+lengthdir_y(partlen/2,rot)+lengthdir_y(th/2,rot-90),0.5,0.5);
- draw_vertex_texture(xx,yy,0,0);
- draw_vertex_texture(xx+lengthdir_x(partlen,rot),yy+lengthdir_y(partlen,rot),1,0);
- draw_vertex_texture(xx+lengthdir_x(partlen,rot)+lengthdir_x(th,rot-90),
- yy+lengthdir_y(partlen,rot)+lengthdir_y(th,rot-90),1,1);
- draw_vertex_texture(xx+lengthdir_x(th,rot-90),yy+lengthdir_y(th,rot-90),0,1);
- draw_vertex_texture(xx,yy,0,0);
- draw_primitive_end();
- //und hier endet es auch schon wieder...
- i+=prec
- }
Zb. sieht das so aus:
ich wette ich habe irgendwas vergessen

MfG SDX