23 lines
585 B
C#
23 lines
585 B
C#
using UnityEngine;
|
|
|
|
namespace Scampz.GameJam.Assets.Scripts
|
|
{
|
|
public class RayCaster : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private float rayCastDistance = 1f;
|
|
|
|
public bool IsWithinBounds()
|
|
{
|
|
var offsetAngle = Quaternion.AngleAxis(45, transform.right);
|
|
return Physics.Raycast(transform.position, offsetAngle * transform.forward);
|
|
}
|
|
|
|
private void OnDrawGizmosSelected()
|
|
{
|
|
var offsetAngle = Quaternion.AngleAxis(45, transform.right);
|
|
Debug.DrawRay(transform.position, offsetAngle * transform.forward * rayCastDistance);
|
|
}
|
|
}
|
|
}
|