diff --git a/Config.json.enc b/Config.json.enc
index 104d85fe6..1b7d61ddf 100644
Binary files a/Config.json.enc and b/Config.json.enc differ
diff --git a/Scripts/Camera/CameraTarget.cs b/Scripts/Camera/CameraTarget.cs
index 66f83b78a..3af610cc6 100644
--- a/Scripts/Camera/CameraTarget.cs
+++ b/Scripts/Camera/CameraTarget.cs
@@ -33,17 +33,61 @@ public class CameraTarget : MonoBehaviour
private static UnityEngine.Camera mp_CameraAttached = null;
[SerializeField]
private bool m_UseCustomPosition = false;
+ [SerializeField]
private Vector3 m_CustomPosition = Vector3.zero;
[SerializeField]
+ private Vector3 m_OffsetPosition = Vector3.zero;
+ private Quaternion m_OffsetPositionRotation = Quaternion.identity;
+ [SerializeField]
private bool m_UseCustomRotation = false;
private Quaternion m_CustomRotation = Quaternion.identity;
private bool m_UseTargetObjectToRotate = false;
+ [SerializeField]
private GameObject m_CustomTargetObjectToLookAt = null;
+ [SerializeField]
+ private bool m_TextEnableCamera = false;
+ [SerializeField]
+ private bool m_TestToMakeItCurrent = false;
+
#endregion
#region Public Members
+ ///
+ /// Gets or sets a value indicating whether this use
+ /// custom position.
+ ///
+ /// true if use custom position; otherwise, false.
+ public bool UseCustomPosition
+ {
+ get
+ {
+ return m_UseCustomPosition;
+ }
+ set
+ {
+ m_UseCustomPosition = value;
+ }
+ }
+
+ ///
+ /// Gets or sets a value indicating whether this use
+ /// custom rotation.
+ ///
+ /// true if use custom rotation; otherwise, false.
+ public bool UseCustomRotation
+ {
+ get
+ {
+ return m_UseCustomRotation;
+ }
+ set
+ {
+ m_UseCustomRotation = value;
+ }
+ }
+
///
/// Gets or sets the target position.
///
@@ -57,9 +101,13 @@ public Vector3 TargetPosition
{
return m_CustomPosition;
}
+ else if (m_OffsetPosition != Vector3.zero)
+ {
+ return transform.position + ( Quaternion.Euler(transform.rotation.eulerAngles - m_OffsetPositionRotation.eulerAngles) * m_OffsetPosition);
+ }
else
{
- return transform.position;
+ return transform.position ;
}
}
set
@@ -77,11 +125,7 @@ public Quaternion TargetRotation
{
get
{
- if (m_UseCustomRotation)
- {
- return m_CustomRotation;
- }
- else if (m_UseTargetObjectToRotate)
+ if (m_UseTargetObjectToRotate)
{
if (TargetObject != null)
{
@@ -102,6 +146,10 @@ public Quaternion TargetRotation
return Quaternion.identity;
}
}
+ else if (m_UseCustomRotation)
+ {
+ return m_CustomRotation;
+ }
else
{
return transform.rotation;
@@ -114,7 +162,11 @@ public Quaternion TargetRotation
}
}
- protected GameObject TargetObject
+ ///
+ /// Gets or sets the target object.
+ ///
+ /// The target object.
+ public GameObject TargetObject
{
get
{
@@ -122,12 +174,24 @@ protected GameObject TargetObject
}
set
{
- m_UseTargetObjectToRotate = true;
- m_CustomTargetObjectToLookAt = value;
+ if (value != null)
+ {
+ m_UseTargetObjectToRotate = true;
+ m_CustomTargetObjectToLookAt = value;
+ }
+ else
+ {
+ m_UseTargetObjectToRotate = false;
+ m_CustomTargetObjectToLookAt = null;
+ }
}
}
- protected UnityEngine.Camera CameraAttached
+ ///
+ /// Gets the camera attached.
+ ///
+ /// The camera attached.
+ public UnityEngine.Camera CameraAttached
{
get
{
@@ -140,7 +204,11 @@ protected UnityEngine.Camera CameraAttached
}
}
- protected WatsonCamera WatsonCameraAttached
+ ///
+ /// Gets the watson camera attached.
+ ///
+ /// The watson camera attached.
+ public WatsonCamera WatsonCameraAttached
{
get
{
@@ -156,7 +224,11 @@ protected WatsonCamera WatsonCameraAttached
#region Set Target on Camera
- protected void SetCurrentTargetOnCamera(bool enable)
+ ///
+ /// Sets the current target on camera.
+ ///
+ /// If set to true enable.
+ public void SetCurrentTargetOnCamera(bool enable)
{
if (WatsonCamera.Instance != null)
{
@@ -167,7 +239,10 @@ protected void SetCurrentTargetOnCamera(bool enable)
}
}
- protected void SetTargetPositionDefault()
+ ///
+ /// Sets the target position default.
+ ///
+ public void SetTargetPositionDefault()
{
if (WatsonCamera.Instance != null && WatsonCamera.Instance.DefaultCameraTarget != null)
{
@@ -175,7 +250,10 @@ protected void SetTargetPositionDefault()
}
}
- protected void SetTargetRotationDefault()
+ ///
+ /// Sets the target rotation default.
+ ///
+ public void SetTargetRotationDefault()
{
if (WatsonCamera.Instance != null && WatsonCamera.Instance.DefaultCameraTarget != null)
{
@@ -184,6 +262,29 @@ protected void SetTargetRotationDefault()
}
#endregion
+
+ #region Update
+
+ void Update()
+ {
+ if (m_TestToMakeItCurrent)
+ {
+ m_TestToMakeItCurrent = false;
+ SetCurrentTargetOnCamera(m_TextEnableCamera);
+ }
+ }
+
+ #endregion
+
+ #region public Functions
+
+ public void SetTargetPositionWithOffset(Vector3 offsetPosition)
+ {
+ m_OffsetPosition = offsetPosition;
+ m_OffsetPositionRotation = this.transform.rotation;
+ }
+
+ #endregion
}
}
diff --git a/Scripts/Camera/WatsonCamera.cs b/Scripts/Camera/WatsonCamera.cs
index 52cf02b08..bf50a2cfe 100644
--- a/Scripts/Camera/WatsonCamera.cs
+++ b/Scripts/Camera/WatsonCamera.cs
@@ -163,7 +163,7 @@ protected virtual void CameraPositionOnUpdate()
if (CurrentCameraTarget != null)
{
transform.localPosition = Vector3.Lerp(transform.localPosition, CurrentCameraTarget.TargetPosition, Time.deltaTime * m_SpeedForCameraAnimation);
- transform.rotation = Quaternion.Lerp(transform.localRotation, CurrentCameraTarget.TargetRotation, Time.deltaTime * m_SpeedForCameraAnimation);
+ transform.rotation = Quaternion.Slerp(transform.localRotation, CurrentCameraTarget.TargetRotation, Time.deltaTime * m_SpeedForCameraAnimation);
}
}
@@ -172,9 +172,17 @@ protected virtual void InitializeCameraTargetList()
if (m_ListCameraTarget == null)
m_ListCameraTarget = new List();
+ for (int i = 0; m_ListCameraTarget != null && i < m_ListCameraTarget.Count; i++)
+ {
+ Destroy(m_ListCameraTarget[i]);
+ }
+
m_ListCameraTarget.Clear();
- CameraTarget defaultCameraTarget = this.gameObject.AddComponent();
+ CameraTarget defaultCameraTarget = this.gameObject.GetComponent();
+ if(defaultCameraTarget == null)
+ defaultCameraTarget = this.gameObject.AddComponent();
+
defaultCameraTarget.TargetPosition = m_CameraInitialLocation;
defaultCameraTarget.TargetRotation = m_CameraInitialRotation;
m_ListCameraTarget.Add(defaultCameraTarget);
@@ -260,6 +268,18 @@ protected virtual void OnCameraSetTwoFingerDrag(System.Object[] args)
}
+ ///
+ /// Event handler reseting the camera. Deleting all camera target and set the initial as default.
+ ///
+ /// Arguments.
+ protected virtual void ResetCamera(System.Object[] args)
+ {
+ if (m_DisableInteractivity)
+ return;
+
+ InitializeCameraTargetList();
+ }
+
///
/// Event handler reseting the camera position.
///
@@ -269,10 +289,11 @@ protected virtual void ResetCameraPosition(System.Object[] args)
if (m_DisableInteractivity)
return;
//Log.Status("WatsonCamera", "Reset Camera Position");
- DefaultCameraTarget.TargetPosition = m_CameraInitialLocation;
- DefaultCameraTarget.TargetRotation = m_CameraInitialRotation;
+ CurrentCameraTarget.TargetPosition = m_CameraInitialLocation;
+ CurrentCameraTarget.TargetRotation = m_CameraInitialRotation;
}
+
///
/// Event handler moving the camera up.
///
diff --git a/ThirdParty/WebSocketSharp/WebSocket.cs b/ThirdParty/WebSocketSharp/WebSocket.cs
index 1d145a2ee..a58e6d678 100755
--- a/ThirdParty/WebSocketSharp/WebSocket.cs
+++ b/ThirdParty/WebSocketSharp/WebSocket.cs
@@ -1125,8 +1125,11 @@ private void fatal (string message, Exception exception)
var code = exception is WebSocketException
? ((WebSocketException) exception).Code
: CloseStatusCode.Abnormal;
-
- fatal (message, code);
+
+ if(exception != null)
+ fatal (message + exception.Message + exception.StackTrace, code);
+ else
+ fatal (message, code);
}
private void fatal (string message, CloseStatusCode code)