TilemapCollider2D 瓦片地图碰撞器2D

class in UnityEngine.Tilemaps

/

Inherits from:Collider2D

/

Implemented in:UnityEngine.TilemapModule

UnityEngine.Tilemaps中的类

/

基础自:Collider2D

/

实现于:UnityEngine.TilemapModule

Description 描述

Collider for 2D physics representing shapes defined by the corresponding Tilemap.

用于2D物理的碰撞器,表示由相应的Tilemap定义的形状.

Properties 属性

挤压系数 extrusionFactor 根据数量让各个瓦片的碰撞器形状进行挤压,使相邻的瓦片合成。使用CompositeCollider2D时,能够消除瓦片之间的细小间隙。这是在世界空间内以Unity单位计算的。 The amount of collider shapes each Tile extrudes to facilitate compositing with neighboring Tiles. This eliminates fine gaps between Tiles when using a CompositeCollider2D. This is calculated in Unity units within world space.
最大瓦片变化数量 maximumTileChangeCount 在进行完全碰撞器重建而不是增量重建之前,累计的“瓦片变化”的最大数量。 Maximum number of Tile Changes accumulated before doing a full collider rebuild instead of an incremental rebuild.

Inherited Members

Properties

已启用 enabled 启用行为已更新,禁用行为未更新。 Enabled Behaviours are Updated, disabled Behaviours are not.
是否已激活并已启用 isActiveAndEnabled 该行为是否已激活并已启用? Has the Behaviour had active and enabled called?
附加刚体 attachedRigidbody Rigidbody2D附加到Collider2D。 The Rigidbody2D attached to the Collider2D.
弹力 bounciness 获取对撞机使用的弹跳力。 Get the bounciness used by the collider.
边界 bounds 碰撞器在世界空间中的边界区域。 The world space bounding area of the collider.
合成 composite 获取可用于附加到对撞机的CompositeCollider2D。 Get the CompositeCollider2D that is available to be attached to the collider.
密度 density 用于计算质量的对撞机的密度(启用自动质量时)。 The density of the collider used to calculate its mass (when auto mass is enabled).
摩擦力 friction 获取对撞机使用的摩擦力。td> Get the friction used by the collider.
是否为触发器 isTrigger 该对撞机是否配置为触发器? Is this collider configured as a trigger?
偏移 offset 对撞机几何体的局部偏移。 The local offset of the collider geometry.
形状数量 shapeCount 对撞机中单独成形区域的数量。 The number of separate shaped regions in the collider.
共用的材质 sharedMaterial 应用于此对撞机的PhysicsMaterial2D。 The PhysicsMaterial2D that is applied to this collider.
被合成使用 usedByComposite 设置碰撞器是否会被CompositeCollider2D使用。 Sets whether the Collider will be used or not used by a CompositeCollider2D.
被效应器 usedByEffector 对撞机是否被附加的效应器使用。 Whether the collider is used by an attached effector or not.
游戏对象 gameObject 该组件附加到的游戏对象。组件始终附加在游戏对象上。 The game object this component is attached to. A component is always attached to a game object.
标签 tag 此游戏对象的标签。 The tag of this game object.
变换 transform 附加到此GameObject的Transform。 The Transform attached to this GameObject.
隐藏标志 hideFlags 该对象是否应该隐藏,随场景保存或可由用户修改? Should the object be hidden, saved with the Scene or modifiable by the user?
名字 name 对象的名称。 The name of the object.

Public Methods 公共方法

投射 Cast 从对撞机位置开始,忽略对撞机本身,将对撞机形状投射到场景中。 Casts the Collider shape into the Scene starting at the Collider position ignoring the Collider itself.
最近点 ClosestPoint 返回此对撞机周界上最接近指定位置的点。 Returns a point on the perimeter of this Collider that is closest to the specified position.
距离 Distance 计算此对撞机与另一个对撞机的最小距离。 Calculates the minimum separation of this collider against another collider.
获取联系 GetContacts 检索此对撞机的所有联系点。 Retrieves all contact points for this Collider.
是否接触 IsTouching 检查此对撞机是否接触了对撞机。 Check whether this collider is touching the collider or not.
是否接触层 IsTouchingLayers 检查此对撞机是否接触了指定layerMask上的任何对撞机。 Checks whether this collider is touching any colliders on the specified layerMask or not.
重叠碰撞器 OverlapCollider 获取与该对撞机重叠的所有对撞机的列表。 Get a list of all colliders that overlap this collider.
重叠点 OverlapPoint 检查对撞机是否与空间点重叠。 Check if a collider overlaps a point in space.
光线投射 Raycast 将光线投射到从对撞机位置开始的场景中,并忽略对撞机本身。 Casts a ray into the Scene that starts at the Collider position and ignores the Collider itself.
广播信息 BroadcastMessage 在此游戏对象或其任何子级中的每个MonoBehaviour上调用名为methodName的方法。 Calls the method named methodName on every MonoBehaviour in this game object or any of its children.
比较标签 CompareTag 这个游戏对象是否带有标签? Is this game object tagged with tag ?
获取组件 GetComponent 如果游戏对象附加了一个,则返回Type类型的组件;如果没有,则返回null。 Returns the component of Type type if the game object has one attached, null if it doesn't.
获取子类组件 GetComponentInChildren 使用深度优先搜索返回GameObject或其任何子级中Type类型的组件。 Returns the component of Type type in the GameObject or any of its children using depth first search.
获取父类组件 GetComponentInParent 返回GameObject或其任何父代中Type类型的组件。 Returns the component of Type type in the GameObject or any of its parents.
获取组件(s) GetComponents 返回GameObject中Type类型的所有组件。 Returns all components of Type type in the GameObject.
获取子类组件(s) GetComponentsInChildren 返回GameObject或其任何子级中Type类型的所有组件。 Returns all components of Type type in the GameObject or any of its children.
获取父类组件(s) GetComponentsInParent 返回GameObject或其任何父代中Type类型的所有组件。 Returns all components of Type type in the GameObject or any of its parents.
发生消息 SendMessage 在此游戏对象中的每个MonoBehaviour上调用名为methodName的方法。 Calls the method named methodName on every MonoBehaviour in this game object.
向上发生消息 SendMessageUpwards 在此游戏对象中的每个MonoBehaviour以及该行为的每个祖先上调用名为methodName的方法。 Calls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour.
尝试获取组件 TryGetComponent 获取指定类型的组件(如果存在)。 Gets the component of the specified type, if it exists.
实例ID GetInstanceID 返回对象的实例ID。 Returns the instance id of the object.
返回字符串 ToString 返回对象的名称。 Returns the name of the object.

Static Methods 静态方法

销毁 Destroy 移除GameObject,组件或资产。 Removes a GameObject, component or asset.
立即销毁 DestroyImmediate 立即销毁对象obj。强烈建议您改用销毁。 Destroys the object obj immediately. You are strongly recommended to use Destroy instead.
不在加载时销毁 DontDestroyOnLoad 加载新场景时,请勿破坏目标对象。 Do not destroy the target Object when loading a new Scene.
查找对象类型 FindObjectOfType 返回第一个Type类型的活动加载对象。 Returns the first active loaded object of Type type.
查找对象(s)类型 FindObjectsOfType 返回所有类型为Type的活动加载对象的列表。 Returns a list of all active loaded objects of Type type.
实例化 Instantiate 克隆对象原始对象并返回克隆。 Clones the object original and returns the clone.

Operators 运算符

布尔 bool 该对象是否存在? Does the object exist?
运算符 operator != 比较两个对象是否引用了另一个对象。 Compares if two objects refer to a different object.
运算符 operator == 比较两个对象引用以查看它们是否引用相同的对象。 Compares two object references to see if they refer to the same object.

Messages 消息

碰撞开始时2D OnCollisionEnter2D 当传入的对撞机与该对象的对撞机接触时发送(仅限2D物理)。 Sent when an incoming collider makes contact with this object's collider (2D physics only).
碰撞结束时2D OnCollisionExit2D 当另一个对象上的碰撞器停止接触该对象的碰撞器时发送(仅2D物理)。 Sent when a collider on another object stops touching this object's collider (2D physics only).
碰撞停留时2D OnCollisionStay2D 将每帧发送到另一个对象上的碰撞器正在触摸该对象的碰撞器的帧(仅适用于2D物理)。 Sent each frame where a collider on another object is touching this object's collider (2D physics only).
触发开始时2D OnTriggerEnter2D 当另一个对象进入连接到该对象的触发对撞机时发送(仅限2D物理)。 Sent when another object enters a trigger collider attached to this object (2D physics only).
触发结束时2D OnTriggerExit2D 当另一个对象将触发对撞机附加到该对象时发送(仅2D物理)。 Sent when another object leaves a trigger collider attached to this object (2D physics only).
触发停留时2D OnTriggerStay2D 在附加到该对象的触发对撞机内将其他对象发送到每个帧(仅2D物理)。 Sent each frame where another object is within a trigger collider attached to this object (2D physics only).