Home   Help Search Login Register  

Author Topic: Where is my camera looking at?  (Read 1299 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
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?