diff --git a/Source/FicsitRemoteMonitoring/Private/RemoteMonitoringLibrary.cpp b/Source/FicsitRemoteMonitoring/Private/RemoteMonitoringLibrary.cpp index 9f6d5bce..0875a5a7 100644 --- a/Source/FicsitRemoteMonitoring/Private/RemoteMonitoringLibrary.cpp +++ b/Source/FicsitRemoteMonitoring/Private/RemoteMonitoringLibrary.cpp @@ -34,21 +34,23 @@ TSharedPtr URemoteMonitoringLibrary::getActorJSON(AActor* Actor) { TSharedPtr JLibrary = MakeShared(); - long double primaryX = Actor->GetActorLocation().X; - long double primaryY = Actor->GetActorLocation().Y; - long double primaryZ = Actor->GetActorLocation().Z; - + const long double primaryX = Actor->GetActorLocation().X; + const long double primaryY = Actor->GetActorLocation().Y; + const long double primaryZ = Actor->GetActorLocation().Z; + const long double pitch = Actor->GetActorRotation().Pitch; + // UE rotations range from -180 to 180 with zero as "forward" and negative values "left". // In Satisfactory this results in a rotation of zero being due east. // FRM will normalise this to a range of 0 <= x < 360 with zero as due north. long double rotation = Actor->GetActorRotation().Yaw; rotation += 450; rotation = fmod(rotation, 360); - + JLibrary->Values.Add("x", MakeShared(primaryX)); JLibrary->Values.Add("y", MakeShared(primaryY)); JLibrary->Values.Add("z", MakeShared(primaryZ)); JLibrary->Values.Add("rotation", MakeShared(rotation)); + JLibrary->Values.Add("pitch", MakeShared(pitch)); return JLibrary;