2-6 raycasting

Mechanism unity event system uses ray casting rendering with an imaginary straight line "of light (Ray)" called to detect conflicts with other objects within the scene.
Input Module (ray casting (Raycaster)) components, the input event is detected to be transmitted for that object within the scene, lighting of the objects within the scene light projection screen according to the specified coordinates, the object closest to the screen is returned.
In unity, in addition to the above components for Graphic Paycaster image elements, there are standard Raycaster Physics Raycaster assembly for 3D objects using 2D and Physics Raycaster assembly used for 2D objects


Physics Raycaster components

 

 

Event Mask property can be provided as the light is projected 3D object object layer
of the component is within the range of the camera writes projected object, and therefore requires additional components Camera.


Physics 2D Raycaster components

 

 

Ibid layer, needs to set the target 2D object colliding machine, at Event Mask property, the light is projected 2D objects can be specified as a target

Collider (Collider) is a component for interpretation of conflict, there is not the same as the shape (Box Collider) and (Sphere Collider), etc.

Guess you like

Origin www.cnblogs.com/bimg1999/p/12594657.html