r2mods/ilspy_dump/ror2_csproj/PositionFromParentRaycast.cs

22 lines
491 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using UnityEngine;
public class PositionFromParentRaycast : MonoBehaviour
{
public float maxLength;
public LayerMask mask;
private void Update()
{
RaycastHit hitInfo = default(RaycastHit);
if (Physics.Raycast(base.transform.parent.position, base.transform.parent.forward, out hitInfo, maxLength, mask))
{
base.transform.position = hitInfo.point;
}
else
{
base.transform.position = base.transform.parent.position + base.transform.parent.forward * maxLength;
}
}
}