[Unity game development] Ray (Ray)

Creating ray Ray ray = new Ray ()

Ray attributes:

origin origin ray emission

The direction of the emitted radiation direction


Ray Collision Detection

Physics-based method using the method of detecting Raycast

bool Raycast(Ray ray, out RaycastHit)

bool Raycast (rays to be transmitted, collision information)


A ray emitted from the main camera to the mouse click position

Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition)

Guess you like

Origin blog.csdn.net/Alina_catty/article/details/79256638