Exemplo n.º 1
0
FExecStatus FCameraCommandHandler::SetCameraRotation(const TArray<FString>& Args)
{
	if (Args.Num() == 4) // ID, Pitch, Roll, Yaw
	{
		int32 CameraId = FCString::Atoi(*Args[0]); // TODO: Add support for multiple cameras
		float Pitch = FCString::Atof(*Args[1]), Yaw = FCString::Atof(*Args[2]), Roll = FCString::Atof(*Args[3]);
		FRotator Rotator = FRotator(Pitch, Yaw, Roll);
		APawn* Pawn = FUE4CVServer::Get().GetPawn();
		AController* Controller = Pawn->GetController();
		Controller->ClientSetRotation(Rotator); // Teleport action
		// SetActorRotation(Rotator);  // This is not working

		return FExecStatus::OK();
	}
	return FExecStatus::InvalidArgument;
}
Exemplo n.º 2
0
FExecStatus FCameraCommandHandler::SetCameraPose(const TArray<FString>& Args)
{
  if (Args.Num() == 7) // ID, X, Y, Z, Pitch, Roll, Yaw
  {
    int32 CameraId = FCString::Atoi(*Args[0]); // TODO: Add support for multiple cameras
    float X = FCString::Atof(*Args[1]), Y = FCString::Atof(*Args[2]), Z = FCString::Atof(*Args[3]);
    FVector Location = FVector(X, Y, Z);
    float Pitch = FCString::Atof(*Args[4]), Yaw = FCString::Atof(*Args[5]), Roll = FCString::Atof(*Args[6]);
    FRotator Rotator = FRotator(Pitch, Yaw, Roll);

    APawn* Pawn = FUE4CVServer::Get().GetPawn();

    bool Sweep = false;
    bool Success = Pawn->SetActorLocation(Location, Sweep, NULL, ETeleportType::TeleportPhysics);

    AController* Controller = Pawn->GetController();
    Controller->ClientSetRotation(Rotator); // Teleport action
    // SetActorRotation(Rotator);  // This is not working

    return FExecStatus::OK();
  }
  return FExecStatus::InvalidArgument;
}