I am trying to get a player GameObject to rotate in a circle around a center point or even an empty GameObject. I would like for this GameObject to also continue looking toward the center. I am having trouble doing so. Here is my code. I am playing around in a 2D space. Thanks.
using UnityEngine;
using System.Collections;
public class PlayerScript : MonoBehaviour {
GameObject center = GameObject.Find("Center");
Vector2 center1 = new Vector2 (0, 0);
//Player Speed
public Vector2 speed = new Vector2(50,50);
private Vector2 circleMovement;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
transform.LookAt(center1);
transform.Translate(Vector2.right * Time.deltaTime);
}
void FixedUpdate() {
}
}