I working with 1 other and we are trying to ray-cast onto a game object i.e (a grind pole) over a time period of 1 second, were in that second, the ray casting object i.e (board) plays a animation over that second while still moving forward and is at a height of + 1 in y axis or simply on top of the pole collier.
Well you might give my previous suggestion a shot, and use a script that does a raycast every frame. Use GetHitInfo() to get the hitInfo and turn off the Component when it isn’t needed.
using UnityEngine;
using System.Collections;
public class PerFrameRayCast : MonoBehaviour
{
public LayerMask layersToIgnore;
protected RaycastHit hitInfo;
protected Transform tr;
protected int layerMask;
void Awake ()
{
tr = transform;
layerMask = ~layersToIgnore.value;
}
void Update ()
{
Physics.Raycast(tr.position, tr.forward, out hitInfo, Mathf.Infinity, layerMask);
}
public RaycastHit GetHitInfo ()
{
return hitInfo;
}
}