Jump to content
Sign in to follow this  
Pint0 Xtreme

Getting object's aiming position

Recommended Posts

Is there any way to get the position where an object's weapon is aiming at? For example, if someone is aiming their weapon and it intersects with position (x,y,z) on the map, how do I get those coordinates? I've searched the forums and I've looked at various aim-related functions (aimPos, weaponAimingAt, etc.) and none seem to give the me the answer I'm looking for. I've also looked at the list of Event Handlers with no avail. Has anyone done this before?

Share this post


Link to post
Share on other sites

Pint0, can you give me an exhaustive list of the functions you found?

Also, are the two functions you listed in ArmA? When I search for them on the Biki, it says they're VBS2 only.

One function I've found is weaponDirection. This tells you what direction the weapon is aiming.

However, this vector cannot tell you a position in space by itself. After some experimentation, I found that, given a vehicle _x (specifically an M119):

_originalAimDirection = weaponDirection _x;
_x doWatch (getpos _x) + (100 * _originalAimDirection);
sleep 5;
weaponDirection _x != _originalAimDirection;

I don't know what reference point weaponDirection is using, but it's not the vehicle's position, or the gunner's.

(I myself would love to know how, given a vector to aim on, to get a vehicle to aim on that vector. I want to make player-controlled artillery batteries.)

Share this post


Link to post
Share on other sites

I've basically looked these lists:

http://community.bistudio.com/wiki/Category:Scripting_Commands_ArmA

http://community.bistudio.com/wiki/Category:Scripting_Commands_VBS2

http://community.bistudio.com/wiki/ArmA:_Event_Handlers

I don't know how I missed weaponDirection but at least it seems like a start. The vector provided gives you the direction of the weapon but then you'd have to figure out the coordinates of where it intersects with the map (if it does). Or perhaps there's a way to detect bullets hitting the surface and finding the location of those points.

Share this post


Link to post
Share on other sites

Is this for a player? or anybody?

screentoworld if it's a player. other than that.. dunno

Share this post


Link to post
Share on other sites
Is this for a player? or anybody?

screentoworld if it's a player. other than that.. dunno

Sorry for the slow response. This is for anybody.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×