Jump to content

Leviathan87

Member
  • Content Count

    2
  • Joined

  • Last visited

  • Medals

Everything posted by Leviathan87

  1. Hi. I need to put an object in space relative to the position of the mouse on the screen. screenToWorld is not suitable because it returns the position relative to the terrain. Is it possible to somehow get the mouse position through positionCameraToWorld? So far, I'm stuck on this piece of code: _startASL = agltoasl ( positionCameraToWorld [ 0,0,0 ] ) ; getMousePosition params ["_xpos","_ypos"]; _Xoffset = _xpos; _Yoffset = - _ypos; _Zoffset = 10; //Depending on z, the x and y offset will be different. The position relative to the mouse is best seen in small _Zoffset values, but it is still inaccurate _endASL = agltoasl ( positionCameraToWorld [ _Xoffset,_Yoffset,_Zoffset ] ) ; _ins = lineIntersectsSurfaces [ _startASL , _endASL , player , objNull , true , 1 , "VIEW" , "NONE" ] ; I think I need to use FOV, angles, extra vectors or something like that. But I have no idea how to do it and my math skills are bad. Please help me!!!
  2. Not exactly. I'm trying to make it so that the object was put in the position of the intersection point, as in the example code below, but only with respect to the position of the mouse _ins = lineIntersectsSurfaces [ AGLToASL positionCameraToWorld [0,0,0], AGLToASL positionCameraToWorld [0,0,1000], player ]; if !(count _ins isEqualTo 0) exitWith {arrow setPosASL (_ins select 0 select 0)}; But because of the use of screenToWorld, which returns a position relative to the terrain, I encounter a problem when the object is not put above a certain position (or something like that)
×