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:
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.
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.