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 w3programmers.org #
 
PREVIOUS NEXT
Tagged: #raycasting #unity
ADD COMMENT
Topic
Name
6+2 =