Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (404)
games submitted by our members
Games in WIP (289)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Calculating horizontal FOV  (Read 683 times)
0 Members and 1 Guest are viewing this topic.
Offline cascade

Junior Member




Java games rock!


« Posted 2004-09-17 16:16:22 »

Hi,

is there anyone who can tell me how to calculate horizontal FOV ?

What I want is to place in object attached to the visible bounds of the view. Now, the upper and lower bounds of the view can be calculated simply rotating the view transform by either FOV or -FOV for upper or lower bound.

However, now I have the problem of doing the same for the left and right side. My first thought was to use the canvas aspect ratio as a factor for the FOV value (e.g. 1.3333f for 4:3 canvas). But with this value the object is outside the view. For a 4:3 canvas the magic number is around 1.25 instead. In a square 1:1 canvas it works of course without correction.

any ideas on how to get the correct factor for the horizontal FOV ?

thanks,
Ca$cade
Offline ewills

Junior Member




Java skeletal animation systems rock!


« Reply #1 - Posted 2004-09-17 21:54:54 »

width/height = hfov/vfov, so hfov = vfov*(width/height).  So you want an object that remains fixed in front of the view?  It sounds like a Foreground node might be the solution.
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #2 - Posted 2004-09-18 00:44:57 »

I need to do this too - I've positioned my Foreground nodes fine for 4:3 but if the user changes the width of the window, they stay where they are.

Will.

Games published by our own members! Check 'em out!
Try the Free Demo of Droid Assault
Offline ewills

Junior Member




Java skeletal animation systems rock!


« Reply #3 - Posted 2004-09-20 04:11:28 »

So you want to keep HUD objects a fixed distance from the left and right edges of the screen?  Can you split the HUD into distinct objects and manage their translations?  If fov remains constant, oldX/oldWidth = newX/newWidth should hold.
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #4 - Posted 2004-09-20 23:16:23 »

yes, my problems are only when the fov changes.  However, this can be common.  For example, my mac has a wide-screen but my PC a 4:3.  Games such as Warcraft still look great on the wide-screen infact you actually see more of the game thus have a slight advantage!  (my brother was not happy when we worked this out, lol).

If I make my game screen wider - the hud elements stay where they are.  They are distinct objects and can be moved, I just need to make them do it.

Will.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (33 views)
2013-05-17 21:29:12

alaslipknot (42 views)
2013-05-16 21:24:48

gouessej (72 views)
2013-05-16 00:53:38

gouessej (71 views)
2013-05-16 00:17:58

theagentd (79 views)
2013-05-15 15:01:13

theagentd (74 views)
2013-05-15 15:00:54

StreetDoggy (114 views)
2013-05-14 15:56:26

kutucuk (138 views)
2013-05-12 17:10:36

kutucuk (138 views)
2013-05-12 15:36:09

UnluckyDevil (146 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.097 seconds with 21 queries.