Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 1 invisible), 1,395 guests, and 12 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Get name of texture? #182646
02/08/08 03:04
02/08/08 03:04
Joined: Sep 2003
Posts: 208
Michael_McCrickard Offline OP
Member
Michael_McCrickard  Offline OP
Member

Joined: Sep 2003
Posts: 208
Maybe I dreamed this, but I thought there a C-Script function that, given x and y coordinates on the screen, would return the name of the texture, if any, at that spot. So if you clicked on any block or prefab, you could get the name of the texture at that spot on the screen. Do you have to use c_trace and tex_name? I thought there was an easier way. Does anyone have example code for getting the texture name at certain x,y coordinates on the screen this way?

Re: Get name of texture? [Re: Michael_McCrickard] #182647
02/08/08 08:50
02/08/08 08:50
Joined: Jan 2007
Posts: 221
F
Fenriswolf Offline
Member
Fenriswolf  Offline
Member
F

Joined: Jan 2007
Posts: 221
Hello,

if I'm not mistaken you have to use c_trace.
With something like the following you should be able to get the texture name at specific screen coordinates:

Code:
// screen_pos.x/.y should contain the screen coordinates
// length_of_trace.. well, it is what is says

var vec_from[3];
var vec_to[3];

vec_set(vec_from, vector(screen_pos.x, screen_pos.y, 0));
vec_set(vec_to, vec_from);

vec_for_screen(vec_from, camera);
vec_to.Z = length_of_trace;
vec_for_screen(vec_to, camera);

c_trace(vec_from, vec_to, IGNORE_MODELS|IGNORE_SPRITES|SCAN_TEXTURE);



Re: Get name of texture? [Re: Fenriswolf] #182648
02/08/08 15:32
02/08/08 15:32
Joined: Sep 2003
Posts: 208
Michael_McCrickard Offline OP
Member
Michael_McCrickard  Offline OP
Member

Joined: Sep 2003
Posts: 208
Thanks so much for this. And if I don't know who long the trace needs to be (I just want to trace until I hit the first block, I could do this in a loop, eh? Start with a short trace and then keep extending it until I hit a block?

Anyway, I think I've got easier solution now to achieve what I was after, but I'm glad to know how to do this for the future.

Thanks again.


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