Question How can I convert RelativeLocationField to GPS location ?

free_sc

New member
Messages
19
Likes
2
Points
3
Hello everyone, Now I can get a dino's relativelocation. I want to convert the x,y,z location value to GPS location value (lat,long). But it seems not work on TheCenter. I paste the code below, how can I improve it ?
-------------------------------------------------------------------

const FVector2D MapCoords = GetMapCoordsFromLocation(Dino->RootComponentField()->RelativeLocationField());

inline FVector2D GetMapCoordsFromLocation(const FVector& Pos)
{
FString Map;
ArkApi::GetApiUtils().GetShooterGameMode()->GetMapName(&Map);
int Divider = Map.Equals("Ragnarok") ? 13100 : 8000;
return FVector2D(Pos.X > -1 ? trunc_decs(50 + Pos.X / Divider, 1) : trunc_decs(50 + Pos.X / Divider, 1),
Pos.Y > -1 ? trunc_decs(50 + Pos.Y / Divider, 1) : trunc_decs(50 + Pos.Y / Divider, 1));
}
 
Advertisement

Monetise Your Game Server

Want to monetise your ARK Server? Create your own webstore at tebex.io

Top