Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (SDK::FKConvexElem& convexElement : bodySetup->AggGeom.ConvexElems)
- {
- const SDK::TArray<SDK::FVector>& vertexData = convexElement.VertexData;
- const size_t vertexDataLength = vertexData.Num();
- if (vertexDataLength == 0)
- continue;
- const SDK::TArray<int32_t>& indexData = convexElement.IndexData;
- const size_t indexDataLength = indexData.Num();
- if (indexDataLength < 3 || indexDataLength % 3 != 0)
- continue;
- for (int32_t i = 0; i + 2 < indexDataLength; i += 3)
- {
- int32_t A_Index = indexData[i];
- int32_t B_Index = indexData[i + 1];
- int32_t C_Index = indexData[i + 2];
- if (A_Index < 0 || A_Index >= vertexDataLength ||
- B_Index < 0 || B_Index >= vertexDataLength ||
- C_Index < 0 || C_Index >= vertexDataLength)
- continue;
- if (A_Index == B_Index || B_Index == C_Index || C_Index == A_Index)
- continue;
- SDK::FVector A_Local = vertexData[A_Index];
- SDK::FVector B_Local = vertexData[B_Index];
- SDK::FVector C_Local = vertexData[C_Index];
- SDK::FVector A_World = SDK::UKismetMathLibrary::TransformLocation(transform, A_Local);
- SDK::FVector B_World = SDK::UKismetMathLibrary::TransformLocation(transform, B_Local);
- SDK::FVector C_World = SDK::UKismetMathLibrary::TransformLocation(transform, C_Local);
- SDK::FVector2D A_Screen, B_Screen, C_Screen;
- bool A_Project = SDK::UGameplayStatics::ProjectWorldToScreen(playerController, A_World, &A_Screen, false);
- bool B_Project = SDK::UGameplayStatics::ProjectWorldToScreen(playerController, B_World, &B_Screen, false);
- bool C_Project = SDK::UGameplayStatics::ProjectWorldToScreen(playerController, C_World, &C_Screen, false);
- if (A_Project && B_Project && C_Project)
- {
- iDrawList->AddLine(ImVec2(A_Screen.X, A_Screen.Y), ImVec2(B_Screen.X, B_Screen.Y), color, 0.5f);
- iDrawList->AddLine(ImVec2(B_Screen.X, B_Screen.Y), ImVec2(C_Screen.X, C_Screen.Y), color, 0.5f);
- iDrawList->AddLine(ImVec2(C_Screen.X, C_Screen.Y), ImVec2(A_Screen.X, A_Screen.Y), color, 0.5f);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment