Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
2 registered members (Grant, AndrewAMD), 911 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to emulate draw_line3d #141124
07/14/07 20:23
07/14/07 20:23
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline OP
User
MrCode  Offline OP
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
I have a physics level that I'm running in the A7 demo (so I really probably should use draw_line3d, but whatever) where when you spawn an entity, a line appears from the center of the level on the first one, and between the last one spawned and the new one just spawned on all the rest. The line is shown only for an instant, so you have to catch it, but it really looks no different from the real draw_line3d:

Code:

function spawn_ball()
{
count_of_ents+= 1;
ent_create ("earth.mdl",vector(random(200),random(-200),random(200)),ball);
phent_addvellocal (_ball,vector(random(50),random(-50),random(-50)),vector(random(-20),random(15),random(-10)));
while(1)
{
vec_set(temp,vector(_ball.x,_ball.y,_ball.z));
vec_to_screen(temp,camera);
draw_line(temp,vector(255,255,255),100);
draw_line(temp,vector(255,255,255),100);
wait(1);
}
}



EDIT: I've also created a program that draws a fake "cube" in the "middle" of a level. Takes a lot of draw_lines, though!

EDIT AGAIN: I think it would be better if I just gave a general format for the Code:

function whatever()
{
while(1)
{
vec_set(temp,vector(x,y,z));
vec_to_screen(temp,camera);
draw_line(temp,vector(b,g,r),a);
draw_line(vector(x,y,z),vector(b,g,r),a);
wait(1);
}
}




Last edited by MrCode; 07/15/07 06:37.
Re: How to emulate draw_line3d [Re: MrCode] #141125
07/15/07 08:35
07/15/07 08:35
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Wow, I was reading your post atleast twice to find a question which isn't there.
If this is a contribution:
Thanks but maybe ask a mod to move it to the contributions forum?

Re: How to emulate draw_line3d [Re: Xarthor] #141126
07/15/07 20:44
07/15/07 20:44
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
i tried myself to but i didnt get somthing on the screen 2d lines
but didnt saw it
maby u find it out ore someone else sow hey can tel use
some info for other people

(for me it isnt importent)

draw_line(VECTOR*, COLOR*, var alpha)
Draw a line to the given XY position with the given color and transparency.

Parameters:
VECTOR* - the end position of the line. The start position is the position of the last draw_line instruction. The Z value must be 0.
COLOR* - the end color of the line. The start color is the color of the last draw_line instruction. If NULL is given, no line is drawn, but the position is set for the start of the next line.
alpha - the end transparency of the line, 0..100.
Speed:
fast
Example:
function draw_red_rect(x1,y1,x2,y2)
{ while(1)
{ draw_line(vector(x1,y1,0),NULL,100); // move to first corner draw_line(vector(x2,y1,0),vector(0,0,255),100); draw_line(vector(x2,y2,0),vector(0,0,255),100); draw_line(vector(x1,y2,0),vector(0,0,255),100); draw_line(vector(x1,y1,0),vector(0,0,255),100); wait(1); }}


"empty"
Re: How to emulate draw_line3d [Re: flits] #141127
07/15/07 21:28
07/15/07 21:28
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline OP
User
MrCode  Offline OP
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
Actually you need to have another vec_to_screen for the second vector. Sorry about that.

Here's the real Code:

var point1[3];
var point2[3];
var color[3]= 255,255,255;

...

function vec_draw_line()
{
while(1)
{
vec_set(point1,vector(-25,-25,-25)); //setting up the positions
vec_set(point2,vector(-25,-25,25));
vec_to_screen(point1,camera); //converting coordinates to 2D
vec_to_screen(point2,camera);
draw_line(point1,color,100); //these are now draw_line3d ;)
draw_line(point2,color,100);
wait(1);
}
}



This should draw a vertical "3D" line starting from coordinates -25,-25,-25.

I tested this code, so now it should work.


Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}
Re: How to emulate draw_line3d [Re: MrCode] #141128
07/16/07 08:48
07/16/07 08:48
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
cool it works now


"empty"

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1