Quantcast
Channel: Answers for "Angle to position on a cube"
Browsing latest articles
Browse All 4 View Live

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 Article


Answer 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

Browsing latest articles
Browse All 4 View Live