Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, alibaba), 1,184 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Right use of vec_to_screen #234618
11/03/08 21:25
11/03/08 21:25
Joined: Mar 2004
Posts: 286
Maintal, Deutschland
TheTommynator Offline OP
Member
TheTommynator  Offline OP
Member

Joined: Mar 2004
Posts: 286
Maintal, Deutschland
Hi,

I'm trying to find out the right use of vec_to_screen.
I want the xy-coordinates of an entity (ball) on screen.
But the manual doesn't describe how to do this. It just explains how to use it for checking if an entity is on screen or not.

So could anyone tell me how to use vec_to_screen to get the xy-coordinates of an entity on screen?

Thanks
TheTommynator


Back @ work with 3DGS.
Re: Right use of vec_to_screen [Re: TheTommynator] #234622
11/03/08 21:44
11/03/08 21:44
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
After the instruction, the X and Y coordinates of the vector contain the XY screen position and the Z coordinate contains the distance to the screen plane. So you just have to read x and y of the given vector.

http://www.conitec.net/beta/avec_to_screen.htm


Always learn from history, to be sure you make the same mistakes again...
Re: Right use of vec_to_screen [Re: Uhrwerk] #234626
11/03/08 22:29
11/03/08 22:29
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
example useage:

Code:
action vts(){
	VECTOR mypos;
	TEXT* txt = txt_create(1,1);
	txt.flags = VISIBLE;
	(txt.pstring)[0] = "..text..";
	while(1){
		vec_set(mypos,my.x);//copy my position to vector "mypos"
		vec_to_screen(mypos,camera);
		txt.pos_x = mypos.x;
		txt.pos_y = mypos.y;
		wait(1);
	}
}


attach this to an entity and the text will always placed on the entity(like names on npcs)


3333333333

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