void UpdateButtonRevealer()
{
Ray ray;
RaycastHit hit;
// get the camera forward vector and position
Ray camRay = CameraRay();
Vector3 cameraPosition = camRay.origin;
Vector3 cameraForward = camRay.direction;
ray = new Ray(cameraPosition, cameraForward);
// Does the ray intersect any objects which are in the player layer.
if (Physics.Raycast(ray, out hit, Mathf.Infinity, 1 << kRevealerLayer))
{
if (previousHitButtonRevealer != hit.transform.gameObject)
{
EndButtonRevealer();
SendEventToGameObject(hit.transform.gameObject, "OnRevealStart");
previousHitButtonRevealer = hit.transform.gameObject;
}
}
else
{
EndButtonRevealer();
}
}