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
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 (SBGuy, AndrewAMD), 739 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
lorikob361, LucasJoshua, Baklazhan, Hanky27, firatv
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
hit.u1,v1 hit.blue,green,red - I can't make it work. #241432
12/16/08 09:46
12/16/08 09:46
Joined: Sep 2007
Posts: 48
Deutschland
H
HoopyDerFrood Offline OP
Newbie
HoopyDerFrood  Offline OP
Newbie
H

Joined: Sep 2007
Posts: 48
Deutschland
Hello,
I have a problem wit the hit CONTACT*. I code a virtual shooting range and need to recognize the position on the taget were the player hits.

My target is a model in the shape of a flat box. It has two skins. On the first skin is the image the player sees. On the second one is a greyscale picture which contains information about the score.




Now I want to get the colour of the 2nd skin on the hit position. With this colour information I could calculate the players score.
I tryed hard to do so but I didn't succeed.

This is my fire code:
Code:
c_trace(camera.x,temp.x,IGNORE_PASSABLE |ACTIVATE_SHOOT|USE_POLYGON|SCAN_TEXTURE);
	
	if(FirePointerFkt)
	{
		FirePointerFkt();
	}

and here I try to store information in some test variables.
Code:
test1 = hit.u1;
test2 = hit.v1;	
test3 = hit.u2;
test4 = hit.v2;
test7 = hit.blue;
test8 = hit.green;
test9 = hit.red;

The function pointer "FirePointerFkt" is set on this function so it's executed immediately after the trace.

The r,g,b variables always have strange, and also differnt values, which shouldn't happen on a greyscale image.
The u1,v1,u2,v2 should get a value between 0 an 512 (image zize) depending on the hit position. Linear from the upper left to the lower down corner. And they get values between 0 and 512 but not linear over the whole target. After analyzing the results I think it's like the whole image is divided in many small squares an in each of them the results are rangeing from 0 to 512. so ist goes "0..256..512.0...256...512.0.." over the whole target (of course all values between too).
Has anybody an idea how I can solve this problem. I hope I could make clear which results I want an which I get instead.

I use the A7.60 Commercial Edition.

[Edit:] Now my confusion is perfect. When I walk around the target model and shoot it from the other side at least the u and v coordinates seem to be correct. r,g,b still aren't.But when i just turn the model for 180 degrees it doesn't work. It really depends on where the camera is. I have absolut no explanation for this... lets call it phenomenon.

Last edited by HoopyDerFrood; 12/16/08 10:32.
Re: hit.u1,v1 hit.blue,green,red - I can't make it work. [Re: HoopyDerFrood] #241519
12/16/08 19:57
12/16/08 19:57
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
I had in my game used not u1,v1, but the UV coordinates from the "v" d3dvertex struct and found them correct. Maybe its something special with your model or even a bug in Gamestudio, you could ask about this under "Ask Conitec".

Re: hit.u1,v1 hit.blue,green,red - I can't make it work. [Re: Spirit] #241814
12/19/08 01:18
12/19/08 01:18
Joined: May 2008
Posts: 123
B
BES Offline
Member
BES  Offline
Member
B

Joined: May 2008
Posts: 123
I sass you Ford! Love the name =)


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