generating circles
This commit is contained in:
parent
0cb415d674
commit
4b68e368fd
File diff suppressed because it is too large
Load Diff
30
Assets/Scripts/CirclePlatformGenerator.cs
Normal file
30
Assets/Scripts/CirclePlatformGenerator.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CirclePlatformGenerator : MonoBehaviour
|
||||
{
|
||||
public Object objectToCopy;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
int pieceCount = 10;
|
||||
float angle = 360f / (float)pieceCount;
|
||||
// var axis = transform.RotateAround(axis, angle * Time.deltaTime * 5f);
|
||||
for (int i = 0; i < pieceCount; i++)
|
||||
{
|
||||
Quaternion rotation = Quaternion.AngleAxis(i * angle, Vector3.forward);
|
||||
Vector3 direction = rotation * Vector3.forward;
|
||||
|
||||
Vector3 position = transform.position + (direction * 20);
|
||||
Instantiate(this.objectToCopy, Vector3.zero, rotation);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
11
Assets/Scripts/CirclePlatformGenerator.cs.meta
Normal file
11
Assets/Scripts/CirclePlatformGenerator.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0418fbcc3e28fec4696b40ecbbf51c7e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user