Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class SpawnCircleNew : MonoBehaviour {
- int numObjects = 12;
- public GameObject prefab;
- void Start() {
- Vector3 center = transform.position;
- for (int i = 0; i < numObjects; i++) {
- int a = i * 30;
- Vector3 pos = RandomCircle(center, 2.0f ,a);
- Instantiate(prefab, pos, Quaternion.identity);
- }
- }
- Vector3 RandomCircle(Vector3 center, float radius,int a)
- {
- Debug.Log(a);
- float ang = a;
- Vector3 pos;
- pos.x = center.x + radius * Mathf.Sin(ang * Mathf.Deg2Rad);
- pos.y = center.y + radius * Mathf.Cos(ang * Mathf.Deg2Rad);
- pos.z = center.z;
- return pos;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment