圣典百科这个中文API真是厉害了 关于LayerMask 层蒙版的中文解释

LayerMask 层蒙版

struct in UnityEngine

Description 描述

LayerMask allow you to display the LayerMask popup menu in the inspector.

layermask允许你在检视面板中显示layermask弹出菜单。

Similar to those in the camera.cullingMask. Layer masks can be used selectively filter game objects for example when casting rays.

类似与camera.cullingmask。layermask 可以选择性地过滤物体,例如当投射射线时。



C#:

using UnityEngine;
using System.Collections;
 
public class ExampleClass : MonoBehaviour {
    public LayerMask mask = -1;
    void Update() {
        if (Physics.Raycast(transform.position, transform.forward, 100, mask.value))
            Debug.Log("Hit something");
 
    }
}

Variables 变量

value Converts a layer mask value to an integer value.
转换层蒙版的值为整数值。

Static Functions 静态函数

GetMask Given a set of layer names as defined by either a Builtin or a User Layer in the Tags and Layers manager, returns the equivalent layer mask for all of them.
无论是内置的层名称集或是由用户在“标签和层管理器”中定义的层,返回与它们相等的层蒙版。
LayerToName Given a layer number, returns the name of the layer as defined in either a Builtin or a User Layer in the Tags and Layers manager.
给定一个层数,返回内置的或在Tags and Layers中定义的层名称。
NameToLayer Given a layer name, returns the layer index as defined by either a Builtin or a User Layer in the Tags and Layers manager.
给定一个层名称,返回内置的或在Tags and Layers manager中定义的层索引。

Operators 运算符

LayerMask Implicitly converts an integer to a LayerMask.
隐式转换整数为层蒙版。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值