Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

raycasting unity

RaycastHit target;

        float raydistance = 50;
        Debug.DrawRay(beamorigin.position, transform.forward*raydistance, Color.yellow);
        if (Physics.Raycast(beamorigin.position, transform.forward*raydistance, out target, raydistance, targetlayer))
        {
            Debug.Log(target.collider.tag);
        }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #raycasting #unity
ADD COMMENT
Topic
Name
5+8 =