Jamie Greunbaum 8eaef49f2e - Added game room, including pool and skee-ball.
- 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.
2026-02-09 03:49:54 -05:00

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;
}
}
}
}