- View tablet spawns in the correct orientation on player respawn. - Added posters, cardboard boxes, barrel, and fire hydrant to alleyway. - Adjusted UV maps for corkboard in round 1. - Added travel posters and shipping crates to round 2 room. - Wall behind players in round 2 moved further back and made slightly larger. - Added moulding and split colours to round 2 walls. - Remade round 2 modem sign SDF textures, making them clearer to read. - Tweaked lightmaps for the location board in round 2. - Lowered resolution of poster and magazine cover textures. - Increased compression on VHS cassette texture. - Posters that were previously shadow casters no longer are. - Camera models also no longer cast shadows.
72 lines
1.7 KiB
C#
72 lines
1.7 KiB
C#
|
|
using UdonSharp;
|
|
using UnityEngine;
|
|
using VRC.SDKBase;
|
|
|
|
|
|
[UdonBehaviourSyncMode(BehaviourSyncMode.None)]
|
|
public class ViewTabletSpawner : UdonSharpBehaviour
|
|
{
|
|
[SerializeField] private Transform _ViewTabletHeadRoot;
|
|
[SerializeField] private Transform _ViewTabletHeadOffset;
|
|
[SerializeField] private Transform _ViewTablet;
|
|
|
|
private bool _FollowPlayerHead = false;
|
|
private float _PreviousHeadYRotation = 0.0f;
|
|
|
|
|
|
void Update()
|
|
{
|
|
VRCPlayerApi LocalPlayer = Networking.LocalPlayer;
|
|
_PreviousHeadYRotation = LocalPlayer.GetBoneRotation(HumanBodyBones.Head).eulerAngles.y;
|
|
|
|
if (_FollowPlayerHead)
|
|
{
|
|
_ViewTabletHeadRoot.position = LocalPlayer.GetBonePosition(HumanBodyBones.Head);
|
|
}
|
|
else
|
|
{
|
|
_ViewTabletHeadRoot.localPosition = Vector3.zero;
|
|
}
|
|
}
|
|
|
|
public override void OnPlayerRespawn(VRCPlayerApi Player)
|
|
{
|
|
if (Player.isLocal)
|
|
{
|
|
Vector3 HeadRotation = Networking.LocalPlayer.GetBoneRotation(HumanBodyBones.Head).eulerAngles;
|
|
HeadRotation.x = HeadRotation.z = 0.0f;
|
|
float DeltaY = HeadRotation.y - _PreviousHeadYRotation;
|
|
HeadRotation.y = _ViewTabletHeadRoot.eulerAngles.y + DeltaY;
|
|
_ViewTabletHeadRoot.rotation = Quaternion.Euler(HeadRotation);
|
|
}
|
|
|
|
base.OnPlayerRespawn(Player);
|
|
}
|
|
|
|
|
|
public void SpawnAtLocalPlayerHead()
|
|
{
|
|
_ResetTabletPosition();
|
|
|
|
Vector3 HeadRotation = Networking.LocalPlayer.GetBoneRotation(HumanBodyBones.Head).eulerAngles;
|
|
HeadRotation.x = HeadRotation.z = 0.0f;
|
|
_ViewTabletHeadRoot.rotation = Quaternion.Euler(HeadRotation);
|
|
|
|
_FollowPlayerHead = true;
|
|
}
|
|
|
|
public void Despawn()
|
|
{
|
|
_ResetTabletPosition();
|
|
_FollowPlayerHead = false;
|
|
}
|
|
|
|
|
|
private void _ResetTabletPosition()
|
|
{
|
|
_ViewTablet.localPosition = Vector3.zero;
|
|
_ViewTablet.localRotation = Quaternion.identity;
|
|
}
|
|
}
|