Created
April 7, 2021 05:16
-
-
Save Jellonator/18e6fce8f42576b2dc5205e6849a60af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func gen_random_in_cone(theta: float) -> Vector3: | |
var z = rand_range(cos(theta), 1.0) | |
var phi = rand_range(0.0, PI * 2.0) | |
var tmp = sqrt(1 - z*z) | |
return Vector3(tmp * cos(phi), tmp * sin(phi), z) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment