Hi everyone… I was getting a weird crash but I was able to fix it. I want to know the reason of why I was getting the crash.
Here is the code that. I am removing the non relevant parts.
FVector OrbitVect = RandStream.VRand();
OrbitVect.Z = OrbitVect.Z / 45; // Makes the orbits flat
FRotator RevTilt = OrbitVect.Rotation();
FPlanetDataBase FirstPlanet(FirstPlanetDis, RevTilt.Quaternion(), 1, Angle, RevRate);
for (int32 i = 1; i < NoOfPlanets; i++)
{
OrbitVect = RandStream.VRand();
OrbitVect.Z = OrbitVect.Z / 45;
RevTilt = OrbitVect.Rotation();
FPlanetDataBase NewPlanet(NewDistance, RevTilt.Quaternion(), LastIndex + 1, Angle, RevRate); // This caused the crash
TempStruct.Planets.Add(NewPlanet);
}
The code compiled fine but when I played the game, the engine crashed with error line shown as above.
I solved it by this method and this works.
FVector OrbitVect = RandStream.VRand();
OrbitVect.Z = OrbitVect.Z / 45; // Makes the orbits flat
FRotator RevTilt = OrbitVect.Rotation();
FPlanetDataBase FirstPlanet(FirstPlanetDis, RevTilt.Quaternion(), 1, Angle, RevRate);
for (int32 i = 1; i < NoOfPlanets; i++)
{
OrbitVect = RandStream.VRand();
OrbitVect.Z = OrbitVect.Z / 45;
RevTilt = OrbitVect.Rotation();
FQuat NewQuat = RevTilt.Quaternion();
FPlanetDataBase NewPlanet(NewDistance, NewQuat, LastIndex + 1, Angle, RevRate); // This caused the crash
TempStruct.Planets.Add(NewPlanet);
}
Any reason what was causing the crash?