UE4外部のアプリケーションに変数の値を渡したい

TCP通信やUDP通信を用いて外部と更新することは可能です

C++を使えば、そこそこ自由な形で外部と通信できますので、挑戦してみてください

(その他の要件はプロジェクトによります)

VRに関する研究を行っている者です。UE4のみでバッファリング等の加工を行うのは諦めて、
UE4とHRTFのリアルタイム畳み込み等の音声周りの制御を行う外部のアプリケーションとを
連携させた仮想空間を作ろうとしております。

UE4内部で、HMDの頭部の位置情報や方向の情報を取得するところまでは
blueprintのGet Orientation and Position等でできることは把握しているのですが、

その変数をUE4の外部へ持続的に渡してやるということは現実的に可能なのでしょうか?
プラグイン等でも構いませんのでどうかお力添えよろしくお願いいたします。

投稿主です。だいぶ遅くなってしまいすみません。

現時点では文字列を送るだけですが、おかげで完成に近づきました。
ありがとうございます。

.h

#pragma once Fill out your
#include "CoreMinimal.h"
#include "winsock2.h"
#include "AllowWindowsPlatformAtomics.h"
#include "Windows.h"
#include "HideWindowsPlatformAtomics.h"
#include "Sockets.h"
#include "HeadMountedDisplayFunctionLibrary.h"
#include "Networking.h"
#include "ws2tcpip.h"
#include "GameFramework/Actor.h"
#include "UDPSender_v2.generated.h"

UCLASS()
class VR1_API AUDPSender_v2 : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	AUDPSender_v2();
protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	virtual void EndPlay(const EEndPlayReason::Type EndPlayReason);
public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;
	

	/*終了処理*/
	void Shutdown();

	/**
	* ソケットを削除
	*/
	void DeleteSocket();


private:
	SOCKET sock;

	int32 iResult;
	struct sockaddr_in addr;
	FVector DevicePosition;
	FRotator DeviceRotation;
	
};

.cpp

#include "UDPSender_v2.h"

AUDPSender_v2::AUDPSender_v2()
{
	PrimaryActorTick.bCanEverTick = true;

}

void AUDPSender_v2::BeginPlay()
{
	Super::BeginPlay();
	WSAData wsaData;
	sock = socket(AF_INET, SOCK_DGRAM, 0);
	WSAStartup(MAKEWORD(2, 0), &wsaData);
	if (iResult != 0) {
		printf("WSAStartup failed: %d\n", iResult);
	}
	
	
	addr.sin_family = AF_INET;
	addr.sin_port = htons(1919);
	addr.sin_addr.S_un.S_addr = inet_addr("127.0.0.1");
	UE_LOG(LogTemp, Log, TEXT("Init UdpSocket."));
	
}

// Called every frame
void AUDPSender_v2::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);
	UHeadMountedDisplayFunctionLibrary::GetOrientationAndPosition(DeviceRotation, DevicePosition);
	

	sendto(sock, "HELLO", 20, 0, (struct sockaddr *)&addr, sizeof(addr));

}

void AUDPSender_v2::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
	Super::EndPlay(EndPlayReason);
	
	Shutdown();
}

void AUDPSender_v2::Shutdown()
{
	DeleteSocket();
	UE_LOG(LogTemp, Log, TEXT("Shutdown UdpSocket."));
}
void AUDPSender_v2::DeleteSocket()
{
	if (!sock) return;
	/*
	sock->Close();
	delete sock;
	sock = nullptr;
	*/
	closesocket(sock);
	WSACleanup();
}