object look center when orbiting with near sides
hello, Im new to unity and ı trying to make pirate ship ai. that attack player with orbiting but how i can make the enemy ship looking player with sides (broadside).like this; 
 the script i used :
         GameObject cube;
         public Transform center;
         public Vector3 axis = Vector3.up;
         public Vector3 desiredPosition;
         public float radius = 2.0f;
         public float radiusSpeed = 0.5f;
         public float rotationSpeed = 80.0f;
 
         void Start () {
             cube = GameObject.FindWithTag("Cube");
             center = cube.transform;
             transform.position = (transform.position - center.position).normalized * radius + center.position;
             radius = 2.0f;
         }
 
         void Update () {
             transform.RotateAround (center.position, axis, rotationSpeed * Time.deltaTime);
             desiredPosition = (transform.position - center.position).normalized * radius + center.position;
             transform.position = Vector3.MoveTowards(transform.position, desiredPosition, Time.deltaTime * radiusSpeed);
         }
     }
 
              You want the ship to face forward while traveling around the player in orbit? (like in the right picture) and have only the sides of the ship face the player?
Answer by vittu1994 · May 28, 2016 at 08:16 PM
If i understand your question correctly and assuming you want the ship to act like in the right picture. You can create a empty gameobject inside the ship as a child object that will be set a bit more forward then the ship. Then you access the transform of this empty gameobject in your ship script and use this in its update:
 transform.LookAt(yourEmptyObject);
 
               Every frame the ship should look at this object and having its forward direction constantly facing it.
I think that would just sail off into the sunset. How about having an object that's at right angles to the ship (so pointing to where the ship it's circling is). Get that to look at the ship being circled but propel the ship forward along it's own transform.
You might have to make the look at object a parent rather than a child but it's Saturday night on a bank holiday weekend (we get $$anonymous$$onday off) in the U$$anonymous$$ so I've already hit the wine and my logic circuits are getting a bit fuzzy! :D
Your answer
 
             Follow this Question
Related Questions
Salingship ai with addforce movement 0 Answers
Problem with a ship controller script 1 Answer
Smooth Rotation Quaternion Lerp? 1 Answer
Enemy watches player and shoots but bullets will not project 0 Answers
Trouble making jumping spider enemies 0 Answers