There is a bug in many scripting commands like GetScreenX() and GetScreenY(), namely ALL that use geCamera_Transform(...) which causes them to only work correctly with a FOV of 2. Otherwise wrong screen coordinates are returned.
The bug is in Pawn.cpp and PawnLow.cpp, as far as i know. I am not sure how to solve the bug.
[FIXED 076] Camera FOV Bug
[FIXED 076] Camera FOV Bug
Everyone can see the difficult, but only the wise can see the simple.
-----
-----
Re: Camera FOV Bug
Can you post a visual example or give the coordinates that were generated?
Many Bothans died to bring you this signature....
Re: Camera FOV Bug
Yes. I used the ShowText command as an example, but retrieving the screen coordinates is done the same way with every scripting command that somehow transforms world coordinates into screen coordinates.
FOV=2 (how it should be)
FOV=3
FOV=1.5
FOV=2 (how it should be)
FOV=3
FOV=1.5
Everyone can see the difficult, but only the wise can see the simple.
-----
-----
Re: Camera FOV Bug
Try using radians. If there is a DegToRads() scripting function, try doing something like this:
fov = DegToRads(90)
To convert degrees into radians and radians into degrees use these formulae:
fov = DegToRads(90)
To convert degrees into radians and radians into degrees use these formulae:
Code: Select all
#define DEGS_PER_RAD ((jeFloat)0.01745329251994329576) // GE_PI / 180.0f
#define RADS_PER_DEG ((jeFloat)57.2957795130823208767) // 180.0f / GE_PI
__inline float DegToRad(float d)
{
return d * DEGS_PER_RAD;
}
__inline float RadToDeg(float r)
{
return r * RADS_PER_DEG;
}
Many Bothans died to bring you this signature....
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
Re: Camera FOV Bug
Instead of geCamera_Transform() and the following calculation the result of geCamera_TransformAndProject should be used here. Will fix this. Jay, could you post a small sample for testing, please?
Re: Camera FOV Bug
Sorry, completely forgot about this topic. I have tested your solution and it works with a multitude of FOVs (so i think it will work with all others too). Do you still need a test script?
Last edited by Jay on Tue May 20, 2008 11:28 pm, edited 1 time in total.
Everyone can see the difficult, but only the wise can see the simple.
-----
-----
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
Re: Camera FOV Bug
No I don't need it anymore, thanks for testing