Answers for "unitry raycast"

C#
0

unitry raycast

using UnityEngine;
//This will cast a raycast from the mouse to the world
public class ExampleClass : MonoBehaviour
{
    void FixedUpdate()
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        if (Physics.Raycast(ray, 100))
            print("Object hit!");
    }
}
Posted by: Guest on December-09-2021

C# Answers by Framework

Browse Popular Code Answers by Language