Page 1 of 1
[FIXED 076] Camera FOV Bug
Posted: Sun Apr 13, 2008 9:51 pm
by Jay
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.
Re: Camera FOV Bug
Posted: Mon Apr 14, 2008 3:21 am
by paradoxnj
Can you post a visual example or give the coordinates that were generated?
Re: Camera FOV Bug
Posted: Mon Apr 14, 2008 10:55 pm
by Jay
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
Re: Camera FOV Bug
Posted: Tue Apr 15, 2008 5:09 pm
by paradoxnj
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:
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;
}
Re: Camera FOV Bug
Posted: Tue Apr 15, 2008 7:41 pm
by QuestOfDreams
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
Posted: Mon May 19, 2008 1:41 pm
by Jay
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?
Re: Camera FOV Bug
Posted: Tue May 20, 2008 7:44 pm
by QuestOfDreams
No I don't need it anymore, thanks for testing