The question is answered, right answer was accepted
Aircraft AI?
So, over the past while, I've been working on a simple arcade flight "Simulator", and now have come to the point where I need to get enemy aircraft to be capable of following the player's jet. How would I go about accomplishing the rotations to allow the vehicles to dynamically bank and turn?
IMPORTANT NOTE I need the enemy aircraft to be able to bank and roll to accommodate it's turning and movement.
Answer by tanoshimi · Mar 06, 2016 at 09:01 AM
I'm guessing you haven't noticed that Unity standard assets come with a pretty comprehensive plane A.I..... Just go Assets -> Import Package -> Vehicles and drag the AircraftJetAI into your scene.
I'll check it out in a bit. Thanks! I will admit I'm advanced enough with Unity, or more importantly art, to not use their Standard assets, so I had no clue. It's moments like these when the internet needs to make a universal facepalm emoticonji more accessable. ;)
Answer by mahdiii · Mar 05, 2016 at 01:19 AM
You can use transform.LookAt to follow. or subtract the position of the enemy's jet from player's jet to get a vector3 and set transform.forward of the enemy's jet to it. So the enemy's jet can see your jet. Then you can use addforce or constant velocity to move the enemy's jet in the z direction(forward direction). It is awful to change transform.forward of the enemy's jet suddenly so use lerp function or another functions to smooth changing.
Banking is the issue here. LookAt won't do the added roll turning. I'll edit my question to fit.