Unity3d ray scan ignore Layer

Source: Internet
Author: User

Address: http://blog.csdn.net/w88193363/article/details/38331205

Function Description

 

Static raycasthit2d []Raycastall (vector2Origin, vector2Direction, floatDistance = mathf. Infinity, intLayermask = defaultraycastlayers, floatMindepth =-mathf. Infinity, floatMaxdepth = mathf. Infinity ); Parameters
Origin The point in 2D space where the ray originates.
Direction Vector representing the direction of the ray.
Distance Maximum distance over which to cast the ray.
Layermask Filter to detect coldocumers only on certain layers.
Mindepth Only include objects with a Z coordinate (depth) greater than this value.
Maxdepth Only include objects with a Z coordinate (depth) less than this value.
Description

Casts a ray against colcyclers in the scene, returning all colcyclers that contact with it. Launch a ray in the scene to detect all collision machines (Collider)

 

 

[CSHARP] View plaincopyprint?
    1. // Layermask parameter indicates the layer to be ignored. The element attribute in the editor is sprite Renderer-> order in Layer
    2. // Set the object to be ignored as the corresponding layer, and then define layermask in the raycastall function as this layer. Then the ray will ignore this layer.
    3. Raycasthit2d [] rharfirst = physics2d. raycastall (qieobject. Transform. Position, vectordir, stagemanager. elementsize, 3 );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.