Making raycast ignore multiple layers
I know how to make the raycast ignore a layer but I want it to ignore layers 9 and 10 but collide with the rest of the layers.
I would do it the other way round: declare the variable private and use the SerializeField attribute. This way you can edit the variable in the inspector and keep it private so other scripts can't directly access it.
Of course when you don't want to show it in the inspector (to be able to change the layermask) you have to choose the layers in your code manually.
I take the example from the OP:
- var layerMask =(1<<9);
- layerMask |=(1<<13);
- layerMask |=(1<<15);
- layerMask =~layerMask;
Or in one line:
- var layerMask =~((1<<9)|(1<<13)|(1<<15));
This would exclude layer 9, 13 and 15.
Keep in mind that the IgnoreRaycastLayer should also be ignored. You can use the Physics.kIgnoreRaycastLayerconstant which is the layermask for the layer2 (has a value of 4 == 1 << 2 ). So just add this:
- [...]
- layerMask |=Physics.kIgnoreRaycastLayer;
- layerMask =~layerMask;
- [...]
Making raycast ignore multiple layers的更多相关文章
- 阅读记录:Learning multiple layers of representation(杂乱笔记)
典型的浅层学习结构: 传统隐马尔可夫模型(HMM).条件随机场 (CRFs).最大熵模型(Maxent).支持向量机(SVM).核回归及仅含单隐层的多层感知器(MLP)等. 局部表示,分布式表示和稀疏 ...
- BPTT for multiple layers
单层rnn的bptt: 每一个时间点的误差进行反向传播,然后将delta求和,更新本层weight. 多层时: 1.时间1:T 分层计算activation. 2.时间T:1 利用本时间点的误差,分层 ...
- MapServer Tutorial——MapServer7.2.1教程学习——第一节用例实践:Example1.2 Static Map with Two Layers
MapServer Tutorial——MapServer7.2.1教程学习——第一节用例实践:Example1.2 Static Map with Two Layers 一.前言 上一篇博客< ...
- Getting svn to ignore files and directories
August 27, 2013Software Developmentresources, subversion, svn, tutorial, version control Who knew it ...
- HANA SQLScript
数据类型 日期时间类型 DATE(日期) DATE 数据类型由年.月.日信息组成,表示一个日期值. DATA 类型的默认格式为‘YYYY-MM-DD’. YYYY 表示年, MM 表示月而 DD 表示 ...
- apex-utility-ai-unity-survival-shooter
The AI has the following actions available: Action Function Shoot Fires the Kalashnikov Reload Reloa ...
- Edge Intelligence: On-Demand Deep Learning Model Co-Inference with Device-Edge Synergy
边缘智能:按需深度学习模型和设备边缘协同的共同推理 本文为SIGCOMM 2018 Workshop (Mobile Edge Communications, MECOMM)论文. 笔者翻译了该论文. ...
- MapServer Tutorial——MapServer7.2.1教程学习——第一节用例实践:Example1.5 Adding a raster layer
MapServer Tutorial——MapServer7.2.1教程学习——第一节用例实践:Example1.5 Adding a raster layer 一.前言 MapServer不仅支持 ...
- [Tensorflow] Cookbook - The Tensorflow Way
本章介绍tf基础知识,主要包括cookbook的第一.二章节. 方针:先会用,后定制 Ref: TensorFlow 如何入门? Ref: 如何高效的学习 TensorFlow 代码? 顺便推荐该领域 ...
随机推荐
- error LNK2038: 检测到“_ITERATOR_DEBUG_LEVEL”的不匹配项:值“0”不匹配值“2”
error: vtkCommon.lib(vtkSmartPointerBase.obj) : error LNK2038: 检测到“_ITERATOR_DEBUG_LEVEL”的不匹配项:值“0”不 ...
- Coursera台大机器学习技法课程笔记04-Soft-Margin Support Vector Machine
之前的SVM非常的hard,要求每个点都要被正确的划分,这就有可能overfit,为此引入了Soft SVM,即允许存在被错分的点,将犯的错放在目 标函数中进行优化,非常类似于正则化. 将Soft S ...
- django-cms 代码研究(七)杂七杂八
实体关系图 核心对象: cms_page/cms_placeholder/cms_cmsplugin. page模型类继承关系图 CMSPlugin&Placeholder模型类继承关系图 = ...
- Python配合BeautifulSoup读取网络图片并保存在本地
本例为Python配合BeautifulSoup读取网络图片,并保存在本地. BeautifulSoup可代替正则表达式,更好地解析Html文本,获取其中的指定内容,如Tag.Property等 # ...
- linux screen 命令详解(未验证+研究)
一.背景 系统管理员经常需要SSH 或者telent 远程登录到Linux 服务器,经常运行一些需要很长时间才能完成的任务,比如系统备份.ftp 传输等等.通常情况下我们都是为每一个这样的任务开一个远 ...
- 分享一个Cnblogs简易APP
最近在学习Android app的开发,俗话说万事开头难,本人也不例外.计算机编程是属于一门要求动手能力和动脑能力都很强的学科,相信很多人都会有这样的经历,看得懂不去用,过不了几天也就忘记了.因而,在 ...
- 利用 FFmpeg palettegen paletteuse 生成接近全色的 gif 动画
下载FFmpeg-VideoToGif-v1.0.bat.7z FFmpeg 2.6 及以上版本有效 未使用palette时 使用palette后 @echo off set inFile=2015. ...
- cc.game
概述 使用cc.game单例代替了原有的cc.Application以及cc.AppControl. cc.game是Cocos2d-JS的游戏对象,主要职责包括,配置的读取,引擎的加载,游戏脚本的加 ...
- CodeForces - 417A(思维题)
Elimination Time Limit: 1000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u Submit ...
- 使用__declspec(export)导出C++类到DLL
使用举例: // File: SimpleDLLClass.h#ifdef SIMPLEDLL_EXPORT //在DLL工程属性-c/c++-预处理器-预处理器定义中添加此宏定义#define DL ...