Making AI plane fly a course

Questions, comments, concerns, & fixes
Post Reply
User avatar
flyingfisch
Contributor
Contributor
Posts: 167
Joined: Wed Aug 29, 2012 10:50 pm
Favorite Aircraft: Saab Gripen
Has thanked: 1 time
Been thanked: 5 times
Contact:

Making AI plane fly a course

Post by flyingfisch » Mon May 06, 2013 10:49 pm

How can I make an AI plane fly a specified course like in EscortMission.yfs?

I looked at the file and found this part which seems useful:

Code: Select all

AIRPLANE "C-130_HERCULES" FALSE
IDENTIFY 0
AIRPCMND POSITION -15000m 2000.00m -7000m
AIRPCMND ATTITUDE -90.00deg 0.00deg -0.00deg
AIRPCMND CTLLDGEA FALSE
AIRPCMND INITSPED 180kt
AIRPCMND INITFUEL 40%
IDANDTAG 0 "INBOUND_C-130"
INTENTIO
GOTOPOSI 0 2000 -7000
GOTOPOSI 22000 1000 -15000
GOTOPOSI 23286.19 800 -16391.36
GOTOPOSI 23552.04 600 -19335.13
GOTOPOSI 21987.53 500 -21142.41
GOTOPOSI 18825.48 500 -22197.1
GOTOPOSI 15279.85 500 -21794.1
AIRSPEED 180kt
ENDINTEN
I modified my code a little like this:

Code: Select all

AIRPLANE US_KC-135E_STRATOTANKER FALSE
STARTPOS NA SOUTH20000_06
IDENTIFY 0
IDANDTAG 2 ""
AIRPCMND UNLOADWP
AIRPCMND LOADWEPN IFLR 20
AIRPCMND INITFUEL 75%
INTENTIO
GOTOPOSI 10000 20000 100
GOTOPOSI 0 0 0
AIRSPEED 300kt
ENDINTEN
Can anyone enlighten me on how to use the GOTOPOSI command? All I can figure out about it is that the second value is altitude.
Image

User avatar
Flake
VFA-49
VFA-49
Posts: 4358
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 838 times
Been thanked: 1248 times
Contact:

Re: Making AI plane fly a course

Post by Flake » Mon May 06, 2013 11:43 pm

All the measurements are in METERS not feet. You're trying to send the aircraft into space!

It will go GOTOPOSI X Y Z

Where X is the horizontal component of the map, y is the height, and z is the vertical component of that map.
I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!

User avatar
decaff_42
Staff
Staff
Posts: 3653
Joined: Sat Oct 29, 2011 7:23 pm
Favorite Aircraft: SR-71 Blackbird
Location: Eastern United States
OS: Mac OSX
Has thanked: 723 times
Been thanked: 1499 times
Contact:

Re: Making AI plane fly a course

Post by decaff_42 » Mon May 06, 2013 11:58 pm

OfficerFlake wrote:
Where X is the horizontal component of the map, y is the height, and z is the vertical component of that map.
THe orientation in Scenery Editor is positive x-axis towards the east, positive Z-axis towards the south.
Check out my website YSDecaff for all my tutorials and addon releases.
Visit by Bitbucket page for Python codes: https://bitbucket.org/decaff42/

Server Flight Log
Addon Database Submit Addon To Database

User avatar
flyingfisch
Contributor
Contributor
Posts: 167
Joined: Wed Aug 29, 2012 10:50 pm
Favorite Aircraft: Saab Gripen
Has thanked: 1 time
Been thanked: 5 times
Contact:

Re: Making AI plane fly a course

Post by flyingfisch » Tue May 07, 2013 4:17 pm

Oh, thanks guys, now I think I understand. :)

Is 0 0 0 the mid point on the map or one of the corners?
Image

User avatar
decaff_42
Staff
Staff
Posts: 3653
Joined: Sat Oct 29, 2011 7:23 pm
Favorite Aircraft: SR-71 Blackbird
Location: Eastern United States
OS: Mac OSX
Has thanked: 723 times
Been thanked: 1499 times
Contact:

Re: Making AI plane fly a course

Post by decaff_42 » Tue May 07, 2013 4:20 pm

It's the middle
Check out my website YSDecaff for all my tutorials and addon releases.
Visit by Bitbucket page for Python codes: https://bitbucket.org/decaff42/

Server Flight Log
Addon Database Submit Addon To Database

User avatar
NavyGator
Veteran
Veteran
Posts: 637
Joined: Fri Jul 15, 2011 6:34 am
Favorite Aircraft: Prop-Driven civil
Location: near Airport HXD
Has thanked: 25 times
Been thanked: 57 times

Re: Making AI plane fly a course

Post by NavyGator » Wed May 08, 2013 9:12 am

In theory it is the center of the map, but, I've found myself ignoring
it's placement occasionally. I've found it to be North of all my land-
masses a time or two; so in reality it can be where-ever you want it
to be. It all depends on where you put your drawing references.
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests