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

Function GenerateDirectionInCone

TombEngine/Math/Random.cpp:103–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101 }
102
103 Vector3 GenerateDirectionInCone(const Vector3& dir, float semiangleInDeg)
104 {
105 float x = GenerateFloat(-semiangleInDeg, semiangleInDeg) * RADIAN;
106 float y = GenerateFloat(-semiangleInDeg, semiangleInDeg) * RADIAN;
107 float z = GenerateFloat(-semiangleInDeg, semiangleInDeg) * RADIAN;
108 auto rotMatrix = Matrix::CreateRotationX(x) * Matrix::CreateRotationY(y) * Matrix::CreateRotationZ(z);
109
110 auto dirInCone = Vector3::TransformNormal(dir, rotMatrix);
111 dirInCone.Normalize();
112 return dirInCone;
113 }
114
115 Vector3 GeneratePointInBox(const BoundingOrientedBox& box)
116 {

Callers 3

SpawnGunSmokeParticlesFunction · 0.85
UpdateStarfieldMethod · 0.85
SpawnMeteorParticlesMethod · 0.85

Calls 2

GenerateFloatFunction · 0.85
NormalizeMethod · 0.45

Tested by

no test coverage detected