diff --git a/Assets/Scripts/Item/Show3DCamera.cs b/Assets/Scripts/Item/Show3DCamera.cs index 229c3904..7247a701 100644 --- a/Assets/Scripts/Item/Show3DCamera.cs +++ b/Assets/Scripts/Item/Show3DCamera.cs @@ -72,6 +72,33 @@ public class Show3DCamera : MonoBehaviour + public void ResetCamera(Transform target, RectTransform inputRect = null, bool isRenderTexture = true) + { + if (target == null) + { + Debug.LogError("Target is not assigned!"); + return; + } + + yaw = 0; + pitch = 0; + // 初始化相机位置 + this.inputRect = inputRect; + this.targetPos = target.transform.position; + // 初始化相机位置 + offset = new Vector3(0, 0, -distance); + + if (isRenderTexture) + { + self.targetTexture = texture; + } + else + { + self.targetTexture = null; + } + UpdateCameraPosition(-1); + } + void Update() { if (targetPos != null && lockMove == false && EventSystem.current.IsPointerOverGameObject() == false) diff --git a/Assets/Scripts/UI/UIBody3D.cs b/Assets/Scripts/UI/UIBody3D.cs index 964e01b1..ba027026 100644 --- a/Assets/Scripts/UI/UIBody3D.cs +++ b/Assets/Scripts/UI/UIBody3D.cs @@ -246,7 +246,7 @@ namespace QFramework.Example public void ResetCamera(float moveTime) { - Show3DCamera.instance.Set(root.transform, distance: 5, isRenderTexture: false, moveTime: moveTime, pitchMin: -80); + Show3DCamera.instance.ResetCamera(root.transform); } protected override void OnShow() diff --git a/Assets/Scripts/Xml/XmlParser.cs b/Assets/Scripts/Xml/XmlParser.cs index 585ab642..1d795f54 100644 --- a/Assets/Scripts/Xml/XmlParser.cs +++ b/Assets/Scripts/Xml/XmlParser.cs @@ -405,9 +405,10 @@ namespace XMLTool Name = bodyElement.Attribute("name")?.Value, Path = bodyElement.Attribute("path")?.Value, Tip = bodyElement.Attribute("tip")?.Value, - Audio = bodyElement.Attribute("audio")?.Value + Audio = bodyElement.Attribute("audio")?.Value, + FocusDistance = bodyElement.Attribute("FocusDistance")?.Value }; - + var isShow = bodyElement.Attribute("isShow"); if (isShow != null) { diff --git a/Doc/Xml閰嶇疆鏂囨。.xml b/Doc/Xml閰嶇疆鏂囨。.xml index adae8340..b8f57467 100644 --- a/Doc/Xml閰嶇疆鏂囨。.xml +++ b/Doc/Xml閰嶇疆鏂囨。.xml @@ -380,4 +380,96 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +