Hello,
I created a circular procedural mesh inside an actor class. Once I bring my actor onto Unreal Engine, it is only visible when the camera is directly looking at it. However, once I move behind it, the circular plane completely disappears. I have looked at it in Lit, Unlit, and Wireframe mode and this happens in all three cases. The actor completely is invisible. Not sure if it is my UV or normals that are off. Or I am missing something else completely.
Below is a copy of my C++ code for my actor with the procedural mesh component.
AOvalProcMesh::AOvalProcMesh()
{
OvalMesh = CreateDefaultSubobject(“OvalMesh”);
RootComponent = OvalMesh;
CreateMesh();
}
void AOvalProcMesh::SetupVector()
{
// setting up imported vector from another class
orbital_path_class Sat_Path1(6731059.507584, 0.0006703, 51.6416, 247.4627, 130.5360, 325.0288);
test_vector = Sat_Path1.calc_Orbit_ECI_coord(6731059.507584, 0.0006703, 51.6416, 247.4627, 130.5360, 325.0288);
}
void AOvalProcMesh::CreateMesh()
{
SetupVector();
Vertices.Add(FVector(0, 0, 0));
for (Count = 0; Count < 359; Count++)
{
Vertices.Add(FVector(test_vector[Count][0], test_vector[Count][1], test_vector[Count][2]));
}
for (Count = 1; Count <= 360; Count++)
{
Triangles.Add(0);
Triangles.Add(Count);
if (Count + 1 > 360)
{
Triangles.Add(1);
}
else
{
Triangles.Add(Count + 1);
}
}
for (Count = 0; Count < 359; Count++)
{
if (Count + 1 == 360)
{
PointA.X = test_vector[Count][0];
PointA.Y = test_vector[Count][1];
PointA.Z = test_vector[Count][2];
PointB.X = test_vector[0][0];
PointB.Y = test_vector[0][0];
PointB.Z = test_vector[0][0];
}
else
{
PointA.X = test_vector[Count][0];
PointA.Y = test_vector[Count][1];
PointA.Z = test_vector[Count][2];
PointB.X = test_vector[Count + 1][0];
PointB.Y = test_vector[Count + 1][1];
PointB.Z = test_vector[Count + 1][2];
}
Normals.Add(FVector::CrossProduct(PointA, PointB));
}
OvalMesh->CreateMeshSection(0, Vertices, Triangles, Normals, TArray(), TArray(), TArray(), false);
}