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
3 registered members (AndrewAMD, Grant, Neb), 908 guests, and 6 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
Read a pixel of a skin #397928
03/25/12 19:28
03/25/12 19:28
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
Hi@all

can someone tell me pls how can i read
the pixel position of a entity skin?

can i do that with a c_trace?

all i find in the manual was pixel_for_bmap
but i can only read that pixel if i know the position

Re: Read a pixel of a skin [Re: GameScore] #397929
03/25/12 19:39
03/25/12 19:39
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Manual:
c_trace --> SCAN_TEXTURE --> hit.u1 / v1
That is what you need

Re: Read a pixel of a skin [Re: GameScore] #397930
03/25/12 19:43
03/25/12 19:43
Joined: Sep 2007
Posts: 101
Luxembourg
K
krial057 Offline
Member
krial057  Offline
Member
K

Joined: Sep 2007
Posts: 101
Luxembourg
[EDIT] Sorry, Widi was faster [/EDIT]


hit.u1 and hit.v1 is what you need. You need to set SCAN_TEXTURE in the c_trace,

This is a snipped form a weapon code from me. It uses the 2nd skin of a model to check the material of an entity that was hit by a bullet:
Php Code:
if(c_trace (mouse_pos3d.x, mouseClick,IGNORE_PASSABLE|SCAN_TEXTURE)>0)
{
BMAP* hitSkin = ent_getskin(you,2);
if(hitSkin)
{
	var format=bmap_lock(hitSkin,0);
	var pixel=pixel_for_bmap(hitSkin,hit.u1,hit.v1);
	COLOR clr;
	pixel_to_vec(clr,NULL,format,pixel);
	bmap_unlock(hitSkin);
//DO something with the color
}
} 




Last edited by krial057; 03/25/12 19:43.
Re: Read a pixel of a skin [Re: krial057] #397934
03/25/12 19:50
03/25/12 19:50
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
tnx a lot laugh

Re: Read a pixel of a skin [Re: GameScore] #398045
03/26/12 19:57
03/26/12 19:57
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
now i trying this example but it does not work fine

i want to change the color if this pixel
where the trace hits the skin of the entity

with hit.u1 and hit.v1 its really really offset

Code:
void paint_to_entity()
{
	
 COLOR clr;
 clr.red = 255; 
 clr.green =0; 
 clr.blue = 0;	

while(1)
{
	
vec_set(draw_target,mouse_dir3d);
vec_scale(draw_target,1000); // set a range
vec_add(draw_target,mouse_pos3d);
vec_set(pencil,mouse_pos3d);
     
	
if(c_trace (mouse_pos3d,draw_target,USE_POLYGON | SCAN_TEXTURE  )>0)
{
BMAP* hitSkin = ent_getskin(you,1);
if(hitSkin)
{
var format=bmap_lock(hitSkin,0);
var pixel = pixel_for_vec(clr, 100, format);
pixel_to_vec(clr,NULL,format,pixel);
pixel_to_bmap(hitSkin,hit.v1,hit.u1, pixel);
bmap_unlock(hitSkin);
}
} 
wait(1);
}	
}



Re: Read a pixel of a skin [Re: GameScore] #398046
03/26/12 20:04
03/26/12 20:04
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
got it laugh
my fault


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