Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

raycast unity

RaycastHit hit;
        // Does the ray intersect any objects excluding the player layer
        if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, Mathf.Infinity, layerMask))
        {
            Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward) * hit.distance, Color.yellow);
            Debug.Log("Hit");
        }
        else
        {
            Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward) * 1000, Color.white);
            Debug.Log("No Hit");
        }
Comment

ray casting unity

Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, Mathf.Infinity, layerMask)
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# implement ienumerable t 
Csharp :: cause bsod c# 
Csharp :: if viewbag is null 
Csharp :: string tochararray c# 
Csharp :: c# backup sql 
Csharp :: c# directory file 
Csharp :: if c# 
Csharp :: wpf textblock line break code behind 
Csharp :: web page search c# 
Csharp :: how to get an arrays length in c# 
Csharp :: c# get logged on user name 
Csharp :: unity reset random seed 
Csharp :: Get Last Access Time Of Directory C# 
Csharp :: unity switch to scene and transfer data 
Csharp :: c# loop array 
Csharp :: C# api get value from header 
Csharp :: c# get witdh of matrix 
Csharp :: Convert Json String to model Class or Object 
Csharp :: same click event diffrenet buttonms c# 
Csharp :: c# singleton 
Csharp :: unity detect when an object has been clicked 
Csharp :: get file name from stream c# 
Csharp :: c# shorthand if statement without else 
Csharp :: math with c sharp 
Csharp :: get position of another object unity 
Csharp :: .net json result status code not working 
Csharp :: unity make a gambeobject array 
Csharp :: allow scroll with wheel mouse datagridview c# 
Csharp :: how to serialize a property in unity 
Csharp :: linq select max value from list 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =