Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class SpawnCircleNew : MonoBehaviour {
- int numObjects = 50;
- public GameObject prefab;
- private Quaternion rot;
- void Start() {
- Time.timeScale = 0.001f;
- Vector3 center = transform.position;
- for (int i = 0; i < numObjects; i++) {
- int a = i * (360/numObjects);
- Vector3 pos = RandomCircle(center, 2.0f ,a);
- Quaternion rotation = Quaternion.FromToRotation (Vector3.down, pos - center);
- Instantiate (prefab, pos, rotation);
- }
- }
- }
- ------
- using UnityEngine;
- using System.Collections;
- public class BulletBehavior : MonoBehaviour {
- void Update (){
- moveWithAngle (360, 0.05f);
- }
- public void moveWithAngle (float pAngle, float pSpeed) {
- this.transform.Translate(pSpeed * Mathf.Cos(Mathf.PI / 180 * pAngle), pSpeed * Mathf.Sin(Mathf.PI / 180 * pAngle), 0f);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment