码迷,mamicode.com
首页 > 其他好文 > 详细

unity3d 射线扫描 忽略图层

时间:2014-08-14 13:13:38      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:des   blog   http   os   io   strong   for   ar   

原地址:http://blog.csdn.net/w88193363/article/details/38331205

函数说明

 

static RaycastHit2D[] RaycastAll(Vector2 origin,Vector2 direction,float distance = Mathf.Infinity,int layerMask = DefaultRaycastLayers,float minDepth = -Mathf.Infinity,float maxDepth = 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 Colliders 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 colliders in the scene, returning all colliders that contact with it.发射一条射线到场景中,检测射线射到的所有碰撞机(collider)

 

 

[csharp] view plaincopyprint?bubuko.com,布布扣bubuko.com,布布扣
 
  1. //layermask的参数表示,要忽略的图层,在编辑器中的元素属性为Sprite Renderer->Order in Layer  
  2. //把要忽略的物体设置为对应图层,然后再raycastall函数中的layermask定义为该图层,射线就会忽略该图层  
  3. RaycastHit2D[] rhArFirst = Physics2D.RaycastAll(qieObject.transform.position, vectorDir, StageManager.elementSize,3);  
bubuko.com,布布扣

unity3d 射线扫描 忽略图层,布布扣,bubuko.com

unity3d 射线扫描 忽略图层

标签:des   blog   http   os   io   strong   for   ar   

原文地址:http://www.cnblogs.com/123ing/p/3911959.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!