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
3 registered members (AndrewAMD, Ayumi, NewbieZorro), 14,141 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
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 | 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