Jump to content
Sign in to follow this  
Birkoff

How do I find x,y,z of where I aim in the terrain as leader.

Recommended Posts

I need to know how I can find out how I can get x,y,z cords for the location I point at with my gun in the terrain, basicly the same as giving order to another person in the group to "move to" but without issuing the "move to" order.

Cheers,

Birkoff

Share this post


Link to post
Share on other sites

First you'll have to convince BIS to let us mod OFP.

(I need access to the same functions for my deploy code).

Share this post


Link to post
Share on other sites

Gotta be a way of doing this, prolly well hidden smile.gif

Intended to use it to make a artillery support script, I've done the script to drop artillery shells etc, but now I need to have it drop them where I click.

But there is another method if someone can help with some math here.

How do I calculate X2,Y2 from my current X,Y positions of I look in one direction.

Say I face 40 degres, stand at 5000,5000 and want artillery shells to land at mypos(and facing direction) + 150m

That should be possible todo by using radio commands, so far I manage to get it to picky my cordinate and add +100m to my x or y, but can't figure out how to make it add direction to get real cords.

Share this post


Link to post
Share on other sites

Birkoff, here you go....

; Generic Rotational/Object Deploy Script

_eng = _this select 0

; _eng is your Engineer/spotter/whatever

;starting positional and directional data for _eng

_engpos=getpos _eng

_engx=getpos _eng select 0

_engy=getpos _eng select 1

_engz=getpos _eng select 2

_engbrg = getdir _eng

;Distance away from Engineer at which object will be deployed

;***replace this with whatever distance you want***

_distance = 2

; Spawn deployable at designated location.

; First, calculate position of targetspot...

; _objxx is distance difference between _eng and desired deployment location on x-axis

_objxx = sin(_engbrg)*_distance

; _objyy is distance difference between _eng and desired deployment location on y-axis

_objyy = cos(_engbrg)*_distance

;Here the new object is created

_obj = "***YOUR OBJECT goes here***" camcreate [(_engx+_objxx),(_engy+_objyy),1]

Should work just fine. I've chopped out most of my deployment stuff, so it's about as generic and easy to understand as it can be.

Thanks to Marlboro for making the trig portion less of a nightmare. Hope it helps....

Share this post


Link to post
Share on other sites

By the way, does anyone know an easy way to calculate altitude above sea level? (getpos doesn't work properly for this).

I need it to calculate terrain slopes to prevent various objects from being deployed on steep inclines.

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  

×