pasteguy10923

untitled paste

Oct 8th, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. FAerialNavigationVoxel* AAerialNavigationManager::GetVoxel(int32 X, int32 Y, int32 Z)
  2. {
  3. auto Plane = NavigationData.Planes[Z];
  4. int32 i = X + GetGridSize().X * Y;
  5. FAerialNavigationVoxel Vox = Plane.Voxels[i]; //UStruct, TArray<FAerialNavigationVoxel> Voxels;
  6.  
  7. UE_LOG(LogTemp, Warning, TEXT("GetVoxelAt: %s"), *Vox.WorldLocation.ToString());
  8.  
  9. return &Plane.Voxels[i];
  10. }
  11.  
  12. FAerialNavigationVoxel* AAerialNavigationManager::GetVoxelAt(FVector Location)
  13. {
  14. if (!IsLocationInBounds(Location)) { return nullptr; }
  15.  
  16. auto GridStart = GetGridStart();
  17.  
  18. int32 X = (Location.X - GridStart.X) / VoxelSize;
  19. int32 Y = (Location.Y - GridStart.Y) / VoxelSize;
  20. int32 Z = (Location.Z - GridStart.Z) / VoxelSize;
  21.  
  22. FAerialNavigationVoxel* VoxelPtr = GetVoxel(X, Y, Z);
  23.  
  24. UE_LOG(LogTemp, Warning, TEXT("GetVoxelAt: %s"), *VoxelPtr->WorldLocation.ToString());
  25.  
  26. return VoxelPtr;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment