unity get a position inside sphere 1

unity get a position inside sphere

float radius;

transform.position = Random.insideUnitSphere * radius;

Here is what the above code is Doing:
1. We create a variable called radius and set it to 10.
2. We then create a variable called transform and set it to the transform component of the object this script is attached to.
3. We then set the position of the transform variable to a random position inside a sphere with a radius of 10.

Similar Posts