↧
Answer by veclock
Think I found a solution: Vector3 p = Random.onUnitSphere*cube.transform.localScale.magnitude; if (p.x > cube.transform.localScale.x*0.5f) { p.x = cube.transform.localScale.x*0.5f; } else if (p.x...
View ArticleAnswer by aldonaletto
That's a good solution, but will fail when the cube is rotated and/or not centered at (0,0,0). Additionally, each time you read cube.transform.localScale, Unity makes calls to the internal functions...
View Article