Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

unity ray from mouse position

RaycastHit hit;
Ray ray = camera.ScreenPointToRay(Input.mousePosition);

if (Physics.Raycast(ray, out hit)) {
  Transform objectHit = hit.transform;

  // Do something with the object that was hit by the raycast.
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# get file size in bytes 
Csharp :: how to call something once in update 
Csharp :: c# preprocessor if not 
Csharp :: OnInitialized blazor 
Csharp :: c# error messagebox 
Csharp :: c# how-to-download-image-from-url 
Csharp :: how to clear console in c# 
Csharp :: unity on mousewheel down 
Csharp :: unity how to copy something to the clipboard 
Csharp :: how to change the color of your text in c# 
Csharp :: unity find gameobject by name 
Csharp :: regex for email c# 
Csharp :: unity distance between 2 vectors 2d 
Csharp :: unity log 
Csharp :: c# set a guid 
Csharp :: decimal in .asp.net core 
Csharp :: setactive unity 
Csharp :: wait in unity 
Csharp :: unity spawn object at position 
Csharp :: how to access gameobject name 
Csharp :: csharp get integer part of number 
Csharp :: unity smooth camera 2d 
Csharp :: OnCollision update 
Csharp :: how to create a rounded custom panel c# 
Csharp :: how to check if list index is out of range in c# 
Csharp :: c# create datatable 
Csharp :: Exit string qoutes c# 
Csharp :: add items to listbox from text file c# 
Csharp :: c# memorystream to byte array 
Csharp :: c# declare inline string array 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =