Jump to content
Sign in to follow this  
captainaimbot

Finding out in which direction the gun of a vehicle is looking at

Recommended Posts

I want to shoot stuff in the air by applying a velocity to an object depending in which direction I look.

From RAV_RAVEN, I found a post where I got this code:

private ["_obj","_gun","_array","_DirGun","_ElevationGun"];

_obj = _this select 0;

_gun = (weapons _obj) select 0;

_array = _obj weaponDirection _gun;

_DirGun = ((_array select 0) atan2 (_array select 1));

_ElevationGun = Deg (_obj AnimationPhase "OtocHlaven");

hint format ["Direction: %1\nElevation: %2", _DirGun, _ElevationGun];

And this for adding velocity

_vel = [0,-1.0,0];

_speed = 5;

_OtherObj setVelocity [(_vel select 0)+(sin _DirGun*_speed),(_vel select 1)+(cos _DirGun*_speed),(_vel select 2)+(cos _DirGun*_speed)];

However, executing the first script will output me the right direction but not the evelation (it keeps 0 no matter where I look)

Also, the velocity script does not add evelation velocity, (which I need to shoot stuff in the air)

What I want to do is to shoot objects with the CDF AA (Shilka)

Can someone who is experienced with scripting help me?

Edited by CaptainAimbot

Share this post


Link to post
Share on other sites

Elevation is the distance from you to the ground, not the top of the barrel to the ground.

Try and find a command that gives you the angle.

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  

×