public void Move(Transform transform, float radius, float speed)
        {
            baseMovement.Move(transform, speed);

            angle -= speed * Time.deltaTime; //if you want to switch direction, use -= instead of +=
            float x = Mathf.Cos(angle) * radius;
            float y = Mathf.Sin(angle) * radius;

            transform.Translate(new Vector3(x, y, 0), Space.World);
        }
Ejemplo n.º 2
0
 public void Move(Transform transform, Vector3 axis, float speed)
 {
     baseMovement.Move(transform, speed);
     transform.Translate((transform.forward * Time.deltaTime * speed) + (axis * Mathf.Sin(Time.time * frequency) * magnitude), Space.World);
 }