Author Topic: Targeting Reticle Not Aligned  (Read 1796 times)

0 Members and 1 Guest are viewing this topic.

Offline mnftg64

  • 27
Targeting Reticle Not Aligned
Hmm, my targeting reticle is very much unaligned when the targeted ship is not in the center of my screen. It is rediculously far off. I have a wide screen computer, is this expected?

EDIT: I just realized this is the FOV bug... Anyone with a widescreen computer know what a good FOV value may be to fix this?
« Last Edit: March 28, 2007, 04:35:50 pm by mnftg64 »

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: Targeting Reticle Not Aligned
There are two functions which are critical to this which would probably be very easy to fix to someone who understands the math.

This function seems to convert the x/y/z position of the 3D object into values of 0.0-1.0 which correspond to screen position (0.0 being up/left, 1.0 being down/right)
Code: [Select]
tx = input->x - View_position.x;
ty = input->y - View_position.y;
tz = input->z - View_position.z;

x = tx * View_matrix.right_vector.x;
x += ty * View_matrix.right_vector.y;
x += tz * View_matrix.right_vector.z;

y = tx * View_matrix.up_vector.x;
y += ty * View_matrix.up_vector.y;
y += tz * View_matrix.up_vector.z;

z = tx * View_matrix.forward_vector.x;
z += ty * View_matrix.forward_vector.y;
z += tz * View_matrix.forward_vector.z;

output->x = x;
output->y = y;
output->z = z;

And then the function that converts these values into actual pixel coordinates

Code: [Select]
w = 1.0f / input->z;
output->x = (Screen_width + (input->x*Screen_width*w))*0.5f;
output->y = (Screen_height - (input->y*Screen_height*w))*0.5f;

I've modified the variable names to make both of these code snippets more understandable. Otherwise, these are extracted directly from the code, and seem to be the only chunks which handle the actual calculations.
-C

 

Offline Polpolion

  • The sizzle, it thinks!
  • 211
Re: Targeting Reticle Not Aligned
Hmm, my targeting reticle is very much unaligned when the targeted ship is not in the center of my screen. It is rediculously far off. I have a wide screen computer, is this expected?

EDIT: I just realized this is the FOV bug... Anyone with a widescreen computer know what a good FOV value may be to fix this?


Are you sure it's FOV? Have you tried in a different resolution?

  

Offline Harbinger of DOOM

  • 28
  • Three fries short of a Happy Meal.
Re: Targeting Reticle Not Aligned
Go into your drivers and toggle something like "Fixed aspect ratio scaling", It'll shrink your screen... but it won't be screwed up anymore.
aldo_14 ~ "The ego has landed."
an0n ~ "Wheee, I can spam and no-one will notice!"