- CameraAnchor can now have camera rotation offsets as well as FOV changes.
- CameraAnchor no longer needs to sync with LightSync, and so does not. - Added noise texture to velvet rope material. - Improved lightmaps on velvet rope model. - Round 1 podiums now return empty strings when no player owns them. - Winning player camera in round 2 now has rotation offset for a later effect. - Jail phone syncs active status better, and finds a player to follow better.
This commit is contained in:
@@ -293,13 +293,13 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: $k
|
||||
Entry: 1
|
||||
Data: CameraRoot
|
||||
Data: _CameraRoot
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: CameraRoot
|
||||
Data: _CameraRoot
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 19|System.RuntimeType, mscorlib
|
||||
@@ -362,13 +362,13 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: $k
|
||||
Entry: 1
|
||||
Data: CameraFOVScaler
|
||||
Data: _CameraModifier
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 23|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: CameraFOVScaler
|
||||
Data: _CameraModifier
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 19
|
||||
@@ -398,8 +398,11 @@ MonoBehaviour:
|
||||
Data: 25|UnityEngine.TooltipAttribute, UnityEngine.CoreModule
|
||||
- Name: tooltip
|
||||
Entry: 1
|
||||
Data: Changing the Z scale of this object will change the FOV of the attached
|
||||
camera.
|
||||
Data: 'Changing the position and rotation of this object will change the position/rotation
|
||||
offset of the attached camera.
|
||||
|
||||
Changing the Z scale of this object
|
||||
will change the FOV of the attached camera.'
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
|
||||
using CameraSystem;
|
||||
using MMMaellon.LightSync;
|
||||
using System.Linq;
|
||||
using UdonSharp;
|
||||
using UnityEngine;
|
||||
using VRC.SDKBase;
|
||||
@@ -28,9 +26,9 @@ public class CameraAnchor : UdonSharpBehaviour
|
||||
[SerializeField] private float NearClippingPlane = 0.3f;
|
||||
[SerializeField] private float FarClippingPlane = 1000.0f;
|
||||
[Space]
|
||||
[SerializeField] private Transform CameraRoot;
|
||||
[Tooltip("Changing the Z scale of this object will change the FOV of the attached camera.")]
|
||||
[SerializeField] private Transform CameraFOVScaler;
|
||||
[SerializeField] private Transform _CameraRoot;
|
||||
[Tooltip("Changing the position and rotation of this object will change the position/rotation offset of the attached camera.\nChanging the Z scale of this object will change the FOV of the attached camera.")]
|
||||
[SerializeField] private Transform _CameraModifier;
|
||||
[Space]
|
||||
[Tooltip("How the camera should follow players, if it's set to do so.")]
|
||||
[SerializeField] private PossibleFollowMethods FollowMethod;
|
||||
@@ -49,7 +47,7 @@ public class CameraAnchor : UdonSharpBehaviour
|
||||
{
|
||||
if (_AttachedCamera)
|
||||
{
|
||||
if (_AttachedCamera.transform.parent != CameraRoot)
|
||||
if (_AttachedCamera.transform.parent != _CameraRoot)
|
||||
{
|
||||
Debug.Log("[CameraAnchor] Camera has been detached from " + gameObject.name + ".");
|
||||
_AttachedCamera = null;
|
||||
@@ -58,7 +56,15 @@ public class CameraAnchor : UdonSharpBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
_AttachedCamera.fieldOfView = FOV * CameraFOVScaler.transform.localScale.z;
|
||||
_AttachedCamera.transform.localPosition = Vector3.Lerp(
|
||||
_AttachedCamera.transform.localPosition,
|
||||
_CameraModifier.localPosition,
|
||||
_CameraFollowSpeed / 10.0f);
|
||||
_AttachedCamera.transform.localRotation = Quaternion.Lerp(
|
||||
_AttachedCamera.transform.localRotation,
|
||||
_CameraModifier.localRotation,
|
||||
_CameraFollowSpeed / 10.0f);
|
||||
_AttachedCamera.fieldOfView = FOV * _CameraModifier.localScale.z;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,16 +90,16 @@ public class CameraAnchor : UdonSharpBehaviour
|
||||
Vector3 CentroidAverage = CentroidSum / _FollowedPlayers.Length;
|
||||
|
||||
Vector3 LookDirection = (CentroidAverage - transform.position).normalized;
|
||||
CameraRoot.transform.rotation = Quaternion.LookRotation(
|
||||
_CameraRoot.transform.rotation = Quaternion.LookRotation(
|
||||
Vector3.Lerp(
|
||||
CameraRoot.transform.forward,
|
||||
Vector3.RotateTowards(CameraRoot.transform.forward, LookDirection, 10.0f, 0.0f),
|
||||
_CameraRoot.transform.forward,
|
||||
Vector3.RotateTowards(_CameraRoot.transform.forward, LookDirection, 10.0f, 0.0f),
|
||||
_CameraFollowSpeed / 10.0f)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
CameraRoot.transform.localRotation = Quaternion.identity;
|
||||
_CameraRoot.transform.localRotation = Quaternion.identity;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,8 +254,9 @@ public class CameraAnchor : UdonSharpBehaviour
|
||||
_AttachedCamera.fieldOfView = FOV;
|
||||
_AttachedCamera.nearClipPlane = NearClippingPlane;
|
||||
_AttachedCamera.farClipPlane = FarClippingPlane;
|
||||
_AttachedCamera.transform.parent = CameraRoot;
|
||||
_AttachedCamera.GetComponent<LightSync>().TeleportToLocalSpace(Vector3.zero, Quaternion.identity, true);
|
||||
_AttachedCamera.transform.parent = _CameraRoot;
|
||||
_AttachedCamera.transform.localPosition = _CameraModifier.localPosition;
|
||||
_AttachedCamera.transform.localRotation = _CameraModifier.localRotation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user