- Moved video screen into its own separate movie tent. - Adjusted stable post-processing volume. - Chickens are now at full volume. - Added button to toggle chickens off and on.
43 lines
1.3 KiB
C#
43 lines
1.3 KiB
C#
using UdonSharp;
|
|
using UnityEngine;
|
|
using VRC.SDK3.Components;
|
|
using VRC.SDKBase;
|
|
using VRC.Udon;
|
|
|
|
namespace VRCBilliardsCE.Packages.com.vrcbilliards.vrcbce.Runtime.Scripts
|
|
{
|
|
/// <summary>
|
|
/// Controls the behaviour of the white guidance line.
|
|
/// </summary>
|
|
[RequireComponent(typeof(LineRenderer))]
|
|
[UdonBehaviourSyncMode(BehaviourSyncMode.None)]
|
|
public class ShotGuideController : UdonSharpBehaviour
|
|
{
|
|
public LayerMask tableLayers;
|
|
public float maxLengthOfLine;
|
|
|
|
private LineRenderer line;
|
|
private RaycastHit hit;
|
|
private Vector3 defaultEndOfLine;
|
|
|
|
public void Start()
|
|
{
|
|
line = GetComponent<LineRenderer>();
|
|
defaultEndOfLine = new Vector3(maxLengthOfLine, 0, 0);
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.right), out hit, maxLengthOfLine, tableLayers))
|
|
{
|
|
line.SetPosition(1, new Vector3(hit.distance, 0, 0));
|
|
line.endWidth = Mathf.Lerp(line.startWidth, 0, Mathf.InverseLerp(0, maxLengthOfLine, hit.distance));
|
|
}
|
|
else
|
|
{
|
|
line.SetPosition(1, defaultEndOfLine);
|
|
line.endWidth = 0;
|
|
}
|
|
}
|
|
}
|
|
} |