카메라디비저장완료
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using Assets.WorkSpace.R;
|
||||
using Octopus.Simulator.Networks;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -117,7 +119,7 @@ namespace RTG
|
||||
public CameraHotkeys Hotkeys { get { return _hotkeys; } }
|
||||
public CameraLimit LimitSetting { get { return _cameraLimitSetting; } }
|
||||
|
||||
|
||||
private WebReceiver _receiver;
|
||||
public bool IsViewportHoveredByDevice()
|
||||
{
|
||||
Vector2 devicePos = RTInputDevice.Get.Device.GetPositionYAxisUp();
|
||||
@@ -140,7 +142,8 @@ namespace RTG
|
||||
|
||||
SetFocusPoint(GetFocusPoint());
|
||||
AdjustOrthoSizeForFocusPt();
|
||||
|
||||
_receiver = FindAnyObjectByType<WebReceiver>();
|
||||
_receiver.onCameraReceived += SetCamera;
|
||||
_isObjectVisibilityDirty = true;
|
||||
}
|
||||
#if UNITY_EDITOR
|
||||
@@ -155,6 +158,16 @@ namespace RTG
|
||||
#endif
|
||||
}
|
||||
|
||||
private void SetCamera(string json)
|
||||
{
|
||||
var cam = JsonUtility.FromJson<CameraEntity>(json);
|
||||
if (_targetCamera != null)
|
||||
{
|
||||
_targetCamera.transform.position = new Vector3(cam.posX, cam.posY, cam.posZ);
|
||||
_targetCamera.transform.transform.eulerAngles = new Vector3(cam.rotX, cam.rotY, cam.rotZ);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetFieldOfView(float fov)
|
||||
{
|
||||
_targetCamera.fieldOfView = fov;
|
||||
|
||||
@@ -4329,8 +4329,8 @@ MonoBehaviour:
|
||||
m_TargetGraphic: {fileID: 1900070398}
|
||||
m_HandleRect: {fileID: 1900070397}
|
||||
m_Direction: 0
|
||||
m_Value: 0
|
||||
m_Size: 0.94925374
|
||||
m_Value: 0.0000053854355
|
||||
m_Size: 0.94925356
|
||||
m_NumberOfSteps: 0
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
@@ -4455,7 +4455,7 @@ MonoBehaviour:
|
||||
m_TargetGraphic: {fileID: 280530798}
|
||||
m_HandleRect: {fileID: 280530797}
|
||||
m_Direction: 2
|
||||
m_Value: 0
|
||||
m_Value: 1
|
||||
m_Size: 1
|
||||
m_NumberOfSteps: 0
|
||||
m_OnValueChanged:
|
||||
@@ -6170,6 +6170,7 @@ GameObject:
|
||||
- component: {fileID: 1916153469}
|
||||
- component: {fileID: 1916153468}
|
||||
- component: {fileID: 1916153467}
|
||||
- component: {fileID: 1916153471}
|
||||
m_Layer: 5
|
||||
m_Name: Canvas
|
||||
m_TagString: Untagged
|
||||
@@ -6268,6 +6269,18 @@ RectTransform:
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
--- !u!114 &1916153471
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1916153466}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ad17c40cd0dc74549b72315f71c1d058, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1925377959
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -7483,7 +7496,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: -1081.1
|
||||
value: -1034.0056
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
|
||||
@@ -122,8 +122,6 @@ namespace Octopus.Simulator.Networks
|
||||
public event Action<MQTTClient> onConnected;
|
||||
private void OnConnected(MQTTClient client, string clientName)
|
||||
{
|
||||
Debug.Log("연결완료");
|
||||
|
||||
clientTable.Add(clientName, client);
|
||||
onConnected?.Invoke(client);
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ using TMPro;
|
||||
using UVC.Networks;
|
||||
using Best.MQTT;
|
||||
using Best.MQTT.Packets;
|
||||
using RTG;
|
||||
using Assets.WorkSpace.R;
|
||||
|
||||
namespace Octopus.Simulator
|
||||
{
|
||||
@@ -36,7 +38,7 @@ namespace Octopus.Simulator
|
||||
Button_Play = transform.Find(nameof(Button_Play)).GetComponent<Button>();
|
||||
Button_FastForward = transform.Find(nameof(Button_FastForward)).GetComponent<Button>();
|
||||
Button_Logic = transform.Find(nameof(Button_Logic)).GetComponent<Button>();
|
||||
Button_Reset= transform.Find(nameof(Button_Reset)).GetComponent<Button>();
|
||||
Button_Reset = transform.Find(nameof(Button_Reset)).GetComponent<Button>();
|
||||
Button_Complete = transform.Find(nameof(Button_Complete)).GetComponent<Button>();
|
||||
text_FastForward = Button_FastForward.GetComponentInChildren<TMP_Text>();
|
||||
onPlaying += onPlay;
|
||||
@@ -69,6 +71,8 @@ namespace Octopus.Simulator
|
||||
isplaying = false;
|
||||
Button_Play.image.sprite = pause;
|
||||
onPlaying?.Invoke(isplaying);
|
||||
var cameraData = Tar();
|
||||
Application.ExternalCall("setCamAngle", cameraData);
|
||||
var requestURL = $"{requestAPI}/{WebParameters.id}/pause";
|
||||
webmanager.Reqeust<HistoryParameters>(requestURL, RequestType.POST, null);
|
||||
}
|
||||
@@ -196,21 +200,40 @@ namespace Octopus.Simulator
|
||||
var requsetURL = $"{webmanager.apiConfig.history}/{WebParameters.id}/toggle-realtime";
|
||||
RealTime rt = new RealTime();
|
||||
rt.realTime = false;
|
||||
webmanager.Reqeust<RealTime>(requsetURL, RequestType.POST, (value)=>ResumeSimulation(), rt);
|
||||
webmanager.Reqeust<RealTime>(requsetURL, RequestType.POST, (value) => ResumeSimulation(), rt);
|
||||
}
|
||||
|
||||
public void ResumeSimulation()
|
||||
{
|
||||
var reqeustURL = $"{webmanager.apiConfig.history}/{WebParameters.id}/resume";
|
||||
emptyClass ec = new emptyClass();
|
||||
webmanager.Reqeust<emptyClass>(reqeustURL, RequestType.POST,null,ec);
|
||||
Application.ExternalCall("setCamAngle", "Test");
|
||||
webmanager.Reqeust<emptyClass>(reqeustURL, RequestType.POST, null, ec);
|
||||
|
||||
}
|
||||
|
||||
private string Tar()
|
||||
{
|
||||
var camera = RTFocusCamera.Get.TargetCamera;
|
||||
var camPos = camera.transform.position;
|
||||
var cmaRot = camera.transform.eulerAngles;
|
||||
|
||||
CameraEntity cameraEntity = new();
|
||||
cameraEntity.posX = camPos.x;
|
||||
cameraEntity.posY = camPos.y;
|
||||
cameraEntity.posZ = camPos.z;
|
||||
cameraEntity.rotX = cmaRot.x;
|
||||
cameraEntity.rotY = cmaRot.y;
|
||||
cameraEntity.rotZ = cmaRot.z;
|
||||
|
||||
var json = JsonUtility.ToJson(cameraEntity);
|
||||
Debug.Log(json);
|
||||
return json;
|
||||
}
|
||||
|
||||
//MQTT 재연결
|
||||
private void ReConnect(MQTTClient client)
|
||||
{
|
||||
if(isplaying)
|
||||
if (isplaying)
|
||||
SetMqttConnect();
|
||||
else
|
||||
{
|
||||
|
||||
@@ -11,6 +11,8 @@ namespace Octopus.Simulator.Networks
|
||||
public event Action onParameterRecived;
|
||||
public event Action<string> onMqttConfigReceived;
|
||||
public event Action<string> onWebConfigReceived;
|
||||
public event Action<string> onCameraReceived;
|
||||
|
||||
|
||||
public void Start()
|
||||
{
|
||||
@@ -48,9 +50,10 @@ namespace Octopus.Simulator.Networks
|
||||
Debug.Log($"webconfig:{json}");
|
||||
}
|
||||
|
||||
public void cameAngle(string angle)
|
||||
public void camAngle(string json)
|
||||
{
|
||||
Debug.Log($"webCam:{angle}");
|
||||
onCameraReceived?.Invoke(json);
|
||||
Debug.Log($"webCam:{json}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,11 @@ namespace Assets.WorkSpace.R
|
||||
[Serializable]
|
||||
public class CameraEntity
|
||||
{
|
||||
public string posX;
|
||||
public string posY;
|
||||
public string posZ;
|
||||
public string rotX;
|
||||
public string rotY;
|
||||
public string rotZ;
|
||||
public float posX;
|
||||
public float posY;
|
||||
public float posZ;
|
||||
public float rotX;
|
||||
public float rotY;
|
||||
public float rotZ;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user