Warning: include(/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php): failed to open stream: No such file or directory in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Warning: include(): Failed opening '/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Notice: Undefined index: OFPEC in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152
    Home   Help Login Register  

Author Topic: Where is my camera looking at?  (Read 2296 times)

0 Members and 1 Guest are viewing this topic.

Offline Morbid Jester

  • Members
  • *
Where is my camera looking at?
« on: 22 Sep 2011, 11:51:27 »
Hi, there. Sorry for crossposting this over several boards, but am stumped. :confused:
I am tinkereing around with the camera in ARMA and I want to obtain the exact coordinates the camera is pointed at. (basically the coordinates of the point where the "gaze direction" of the camera intersects with the "floor".

Here is what I want to do:

Compare the coordinates from the camera viewpoint to the position of a unit (which is supposed to be within a certain range around the position. If it is, I want to trigger another event.

Here is what i did so far to get there:

I have created a camera at a fixed position, the camera can be panned around and zoomed using a Joystick. Works a treat.
Somehow I fail in getting the the map position of the place the camera is looking at at a specific time (defined by a keypress). I use the information from "camPrepareTarget" to get the info using the following line of code:


Code: [Select]
   _target setPosASL [_camx + (cos _direction) * (cos _dive) * 100000, _camy + (sin _direction) * (cos _dive) * 100000, _camz + (sin _dive) * 100000]
    _camera CamSetTarget _target


where

_camx=x-coordinate of Camera Position
_camy=y-coordinate of Camera Position
_camz=z-coordinate of Camera Position
_direction="gaze direction" of the camera right/left (0-360°)
_dive=camera inclination (-90° - +90°)


Example:
For a certain camera Position and gaze direction, I SHOULD be getting this output (and I do so using camera.sqs):

Code: [Select]
    ;=== 12:26:02
    _camera camPrepareTarget [14312.83,12475.29,-0.00]
    _camera camPreparePos [14190.81,11883.26,106.64]
    _camera camPrepareFOV 0.029
    _camera camCommitPrepared 0
    @camCommitted _camera


However, I DO get the following:

Code: [Select]
    ;=== 12:25:59
    _camera camPrepareTarget [33980.69,107899.38,-19571.55]
    _camera camPreparePos [14190.81,11883.24,106.64]
    _camera camPrepareFOV 0.029
    _camera camCommitPrepared 0
    @camCommitted _camera

Since I do not want to use the camera.sqs (which would mean a detour via a text-file I'd like to avoid) I am looking for a way to obtain the correct data directly. There is a way to do it within Arma, because the camera.sqs delivers.

Anyone out there have any idea?