how to make game objects spread in a specific vector

The solution for “how to make game objects spread in a specific vector” can be found here. The following code will assist you in solving the problem.

float radius = 1f;
for (int i = 0; i < 8; i++) { float angle = i * Mathf.PI*2f / 8; Vector3 newPos = new Vector3(Mathf.Cos(angle)*radius, y, Mathf.Sin(angle)*radius); GameObject go = Instantiate(GameObject.CreatePrimitive(PrimitiveType.Cube), newPos, Quaternion.identity); }

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in