[FIXED 076] Camera FOV Bug

Post any Bug Reports here
Post Reply
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

[FIXED 076] Camera FOV Bug

Post 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.
Everyone can see the difficult, but only the wise can see the simple.
-----
User avatar
paradoxnj
RF2 Dev Team
Posts: 1328
Joined: Wed Mar 01, 2006 7:37 pm
Location: Brick, NJ
Contact:

Re: Camera FOV Bug

Post by paradoxnj »

Can you post a visual example or give the coordinates that were generated?
Many Bothans died to bring you this signature....
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: Camera FOV Bug

Post 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)
Image Image

FOV=3
Image Image

FOV=1.5
Image Image
Everyone can see the difficult, but only the wise can see the simple.
-----
User avatar
paradoxnj
RF2 Dev Team
Posts: 1328
Joined: Wed Mar 01, 2006 7:37 pm
Location: Brick, NJ
Contact:

Re: Camera FOV Bug

Post 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;
}
Many Bothans died to bring you this signature....
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: Camera FOV Bug

Post 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?
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: Camera FOV Bug

Post 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?
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.
-----
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: Camera FOV Bug

Post by QuestOfDreams »

No I don't need it anymore, thanks for testing :)
Post Reply