MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / GenerateDirection

Function GenerateDirection

TombEngine/Math/Random.cpp:90–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88 }
89
90 Vector3 GenerateDirection()
91 {
92 float theta = GenerateFloat(0.0f, PI_MUL_2); // Generate angle in full circle.
93 float phi = GenerateFloat(0.0f, PI); // Generate angle in sphere's upper half.
94
95 auto dir = Vector3(
96 sin(phi) * cos(theta),
97 sin(phi) * sin(theta),
98 cos(phi));
99 dir.Normalize();
100 return dir;
101 }
102
103 Vector3 GenerateDirectionInCone(const Vector3& dir, float semiangleInDeg)
104 {

Callers 5

TriggerRocketSmokeFunction · 0.85
SpawnDustParticlesMethod · 0.85
SpawnBubbleFunction · 0.85
SpawnChaffBubbleFunction · 0.85

Calls 3

GenerateFloatFunction · 0.85
Vector3Function · 0.50
NormalizeMethod · 0.45

Tested by

no test coverage detected