Hi,
Is there a way to reset the raycast after the object leaves the ray? I’m having a dilemma where I’m casting a ray 10 units forward with an object, if it hits that object is assigned as the ray hit, but I need the ray hit to be reset to false after that object leaves the ray.`
var dHit : RaycastHit;
if(Physics.Raycast(transform.position,-Vector3.up, dHit, .55)) //raycasts a line downwards, checks if player is on ground
{
if(dHit.collider != null)//player is on ground, sets down state as 1 (for use with jumping)
{
dState = 1;
}
else
{
dState = 0;
}
`