Cranch

Untitled

Oct 30th, 2025
1,292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.08 KB | None | 0 0
  1. for (SDK::FKConvexElem& convexElement : bodySetup->AggGeom.ConvexElems)
  2. {
  3.                 const SDK::TArray<SDK::FVector>& vertexData = convexElement.VertexData;
  4.                 const size_t vertexDataLength = vertexData.Num();
  5.                 if (vertexDataLength == 0)
  6.                     continue;
  7.  
  8.                 const SDK::TArray<int32_t>& indexData = convexElement.IndexData;
  9.                 const size_t indexDataLength = indexData.Num();
  10.                 if (indexDataLength < 3 || indexDataLength % 3 != 0)
  11.                     continue;
  12.  
  13.                 for (int32_t i = 0; i + 2 < indexDataLength; i += 3)
  14.                 {
  15.                     int32_t A_Index = indexData[i];
  16.                     int32_t B_Index = indexData[i + 1];
  17.                     int32_t C_Index = indexData[i + 2];
  18.  
  19.                     if (A_Index < 0 || A_Index >= vertexDataLength ||
  20.                         B_Index < 0 || B_Index >= vertexDataLength ||
  21.                         C_Index < 0 || C_Index >= vertexDataLength)
  22.                         continue;
  23.  
  24.                     if (A_Index == B_Index || B_Index == C_Index || C_Index == A_Index)
  25.                         continue;
  26.  
  27.                     SDK::FVector A_Local = vertexData[A_Index];
  28.                     SDK::FVector B_Local = vertexData[B_Index];
  29.                     SDK::FVector C_Local = vertexData[C_Index];
  30.  
  31.                     SDK::FVector A_World = SDK::UKismetMathLibrary::TransformLocation(transform, A_Local);
  32.                     SDK::FVector B_World = SDK::UKismetMathLibrary::TransformLocation(transform, B_Local);
  33.                     SDK::FVector C_World = SDK::UKismetMathLibrary::TransformLocation(transform, C_Local);
  34.  
  35.                     SDK::FVector2D A_Screen, B_Screen, C_Screen;
  36.                     bool A_Project = SDK::UGameplayStatics::ProjectWorldToScreen(playerController, A_World, &A_Screen, false);
  37.                     bool B_Project = SDK::UGameplayStatics::ProjectWorldToScreen(playerController, B_World, &B_Screen, false);
  38.                     bool C_Project = SDK::UGameplayStatics::ProjectWorldToScreen(playerController, C_World, &C_Screen, false);
  39.  
  40.                     if (A_Project && B_Project && C_Project)
  41.                     {
  42.                         iDrawList->AddLine(ImVec2(A_Screen.X, A_Screen.Y), ImVec2(B_Screen.X, B_Screen.Y), color, 0.5f);
  43.                         iDrawList->AddLine(ImVec2(B_Screen.X, B_Screen.Y), ImVec2(C_Screen.X, C_Screen.Y), color, 0.5f);
  44.                         iDrawList->AddLine(ImVec2(C_Screen.X, C_Screen.Y), ImVec2(A_Screen.X, A_Screen.Y), color, 0.5f);
  45.                     }
  46.                 }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment