Home   Help Search Login Register  

Author Topic: Player's vehicle current camera FOV level  (Read 1929 times)

0 Members and 1 Guest are viewing this topic.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Player's vehicle current camera FOV level
« on: 01 Oct 2007, 15:41:30 »
Is there any way to determine it?

For example, you get as gunner in a Vulcan, and your FOV is clearly 1.0, then you do the same with a Shilka, but this time optics are automatically used and the FOV is decreased to have the image zoomed in, but you switch to external view while being gunner and FOV resets to 1.

So, again, the question is: how to know the current zoom level (FOV) of current camera attached to player's vehicle.

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Player's vehicle current camera FOV level
« Reply #1 on: 01 Oct 2007, 21:08:15 »
You might find the values in the vehicles config file.

In the case of the Shilka that would be the tracked.pbo config.bin.

Look for these values:

       initFov = 0.xx;
       minFov = 0.xx;
       maxFov = 0.xx;


Planck
I know a little about a lot, and a lot about a little.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Player's vehicle current camera FOV level
« Reply #2 on: 01 Oct 2007, 22:39:34 »
I was going to suggest those, but isn't the problem that you still wouldn't know the current FOV, only its potential range. That may be enough for what Mandoble wanted to know, though. Also, I know you can find out which particular turret someone is in with assignedVehicleRole, but I don't think you can tell which view they are using within that turret, such as turned in/turned out/normal/optics/etc, can you? If it is possible, then it would be something I'd really like to be able to determine too....
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Player's vehicle current camera FOV level
« Reply #3 on: 01 Oct 2007, 22:52:00 »
It actually is possible to tell which view the player is using, I started to write a function for it a while back but it's not foolproof, for example buldings/elevated terrain blocking the camera moving would cause erroneous results.
Also, each vehicle has the camera positions a bit different from each other which also causes trouble..

Which is why I dropped the 'project', time constraints also played a part in it..
Dunno if I have it laying around somewhere..  :dunno:
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Player's vehicle current camera FOV level
« Reply #4 on: 01 Oct 2007, 23:43:45 »
It actually is possible to tell which view the player is using

Based on what?

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Player's vehicle current camera FOV level
« Reply #5 on: 02 Oct 2007, 09:03:14 »
On the camera distance from the player/vehicle.
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Player's vehicle current camera FOV level
« Reply #6 on: 02 Oct 2007, 09:05:41 »
And how do you get the current camera used by the player in a vehicle?

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Player's vehicle current camera FOV level
« Reply #7 on: 02 Oct 2007, 09:10:00 »
I think it was something like (function was called with vehicle call func)
Code: [Select]
_camPos = positionCameraToWorld [0,0,0];
_posThis = position (vehicle _this);
_dist = (_camPos distance _posThis);

Annoying, I'll bet you're able to make it work  :whistle:
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Player's vehicle current camera FOV level
« Reply #8 on: 02 Oct 2007, 09:53:12 »
Ah, a command that I'd missed. You could certainly do something more accurate with that by using positionCameraToWorld then worldToModel which would a relative position of the camera rather than just relying on distance. Using the position, rather than distance, would make the function less likely to be broken in special circumstances such as when a script is using an external camera (cutscene) or an addon has added an extra view/turret to the vehicle (or at least be able to return an "unknown" result when it isn't sure).

positionCameraToWorld, worldToModel, posScreenToWorld - BIS's amazingly consistent command naming policy hits again ::)
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Player's vehicle current camera FOV level
« Reply #9 on: 02 Oct 2007, 10:14:57 »
It's funny how these things happen, the mod I work for requested some sort of method to limit the view access in some vehicles and I just happened to test that above distance thingy in th eprocess and to my surprise it worked.. It was discarded though, the things they needed could be done via config..

Mandoble probably comes up with something incredibly simple and yet genius with that, my approach was to see if the camera position fell in between certain distance limits and return the view according to that.
Worked with men flawlessly (as far as I tested it) but when entering vehicles it became harder since in some vehicles the distance for sight view can be longer than 1st person view (just an example)..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Player's vehicle current camera FOV level
« Reply #10 on: 02 Oct 2007, 10:42:10 »
Problem here is that position of the camera doesnt change depending on zoom.
For example, you are the gunner of a T72 and you aim towards a tank and then set maximum zoom, is not that camera moved ahead half the range towards the enemy tank, if a bird crosses the nose of your gun you will see the bird, so the camera position is not changing.

I cannot see any real way to solve the problem, but there might be a workaroud to solve the problem partially.
When the player gets into any vehicle, in some cases its "view" is zoomed in, in some others isnt. When the view is zoomed in (for example because you are automatically switched to use optics), initFov config parameter would tell you the initial zoom level (while in some cases the player may still play with + and - to adjust it). To implement this workaroud there is still a problem to solve: which criteria to use to determine in which cases the "zoomed in as you enter a vehicle" will happen.

Example cases:
ZSU: As you moves as gunner, you are zoomed in with the gun optics on.
Vulcan: As you moves as gunner, you are not automatically zoomed in (and the gunner is "outside" the vehicle).
Cobra: The gunner is not automatically zommed in (and the gunner is "inside" the vehicle).
BMP2: As wil the ZSU, the gunner is automatically zoomed in with gun optics on.
Stryker MK19: The gunner is not zoomed in initially, but the gunner is "inside" the vehicle (opposite case to ZSU and Vulcan).

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Player's vehicle current camera FOV level
« Reply #11 on: 02 Oct 2007, 16:22:57 »
 :D To hit you back with tricky questions like you tend to do...what do you need this for? Visual effects/extra gunner optics...what?  :scratch:

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Player's vehicle current camera FOV level
« Reply #12 on: 02 Oct 2007, 16:50:16 »
scripted extra gunner/driver/commander optics