Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, AndrewAMD), 14,136 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
place model at 2D position? #179180
01/21/08 20:45
01/21/08 20:45
Joined: Jan 2004
Posts: 59
S
SH6811 Offline OP
Junior Member
SH6811  Offline OP
Junior Member
S

Joined: Jan 2004
Posts: 59
Hi,

When I "create" an entity I'd like to be able to simply position it using 2D coordinates, NOT 3D! Thus for example I'd like to create an entity and place it at screen coordinates 500x400...again not the "world coordinates"...how is this best accomplished? I'm having problems using vec_to_screen, it's probably not the correct command for this...thank you in advance.

Re: place model at 2D position? [Re: SH6811] #179181
01/22/08 07:35
01/22/08 07:35
Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
kasimir Offline
Senior Member
kasimir  Offline
Senior Member

Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
here is an example of vec_for_screen:

Code:

function mouse_to_level
{
var vec_from[3];
var vec_to[3];

vec_from.x = mouse_pos.x;//can also be your "2d coordinates"
vec_from.y = mouse_pos.y;//can also be your "2d coordinates"

vec_from.z = 10;

vec_set(vec_to,vec_from);
vec_for_screen(vec_from,camera);

vec_to.z = 100;//distance_from_screen
vec_for_screen(vec_to,camera);

trace_mode = ignore_me + ignore_sprites + ignore_models + ignore_passable;
return(trace(vec_from,vec_to));
}

function get_target
{
mouse_to_level();
ent_create("xxx.mdl,target.x,function);
}

on_mouse_left = get_target();


but perhaps its enougth if you use view-enitys?!

Re: place model at 2D position? [Re: kasimir] #179182
01/22/08 17:45
01/22/08 17:45
Joined: Jun 2004
Posts: 12
cweth Offline
Newbie
cweth  Offline
Newbie

Joined: Jun 2004
Posts: 12
how does the trace() function work, and what is "target.x"? this code creates an entity in the top right corner of screen regardless of where i click on the screen.

Re: place model at 2D position? [Re: cweth] #179183
01/22/08 17:58
01/22/08 17:58
Joined: Jan 2004
Posts: 59
S
SH6811 Offline OP
Junior Member
SH6811  Offline OP
Junior Member
S

Joined: Jan 2004
Posts: 59
Thanks for the reply. Is it possible for a View Entity to be made sensitive to mouse clicks and mouse hovers?


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

Gamestudio download | 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