用户工具

站点工具


侧边栏



Unity3D中文文档

script:unityengine:classes:collider:collider

Collider 碰撞器

Namespace: UnityEngine
Inherits from: Component

Description 描述

A base class of all colliders.

所有碰撞器的基类。

See Also: BoxCollider, SphereCollider, CapsuleCollider, MeshCollider, PhysicMaterial, Rigidbody.

If the object with the Collider needs to be moved during gameplay then you should also attach a Rigidbody component to the object. The Rigidbody can be set to be kinematic if you don't want the object to have physical interaction with other objects.

如果一个对象带有碰撞器,需要在游戏中移动,那么你应该添加个Rigidbody组件给它。如果你不想该对象与其他对象有交互,刚体可以设置为运动学刚体(kinematic)。

Variables 变量

attachedRigidbodyThe rigidbody the collider is attached to.
碰撞器附加的刚体。
boundsThe world space bounding volume of the collider.
碰撞器框的体积大小。
contactOffsetContact offset value of this collider.
该碰撞器的触点偏移值。
enabledEnabled Colliders will collide with other colliders, disabled Colliders won't.
启用碰撞器将会碰撞其他碰撞器,禁用碰撞器就不会碰撞其他碰撞器。
isTriggerIs the collider a trigger?
碰撞器是一个触发器?
materialThe material used by the collider.
用于碰撞器的材质。
sharedMaterialThe shared physic material of this collider.
该碰撞器的共享的物理材质。

Public Functions 共有函数

ClosestPointOnBoundsThe closest point to the bounding box of the attached collider.
到碰撞器的框最近的点。
RaycastCasts a Ray that ignores all Colliders except this one.
投射一条射线(Ray),它忽略所有碰撞器,除了这个。

Messages 消息

OnCollisionEnterOnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider.
当该collider/rigidbody开始碰到另一个rigidbody/collider时OnCollisionEnter被调用。
OnCollisionExitOnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider.
当 collider/rigidbody停止碰撞另一个 rigidbody/collider时,OnCollisionExit被调用。
OnCollisionStayOnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider.
每当该collider/rigidbody碰到其他rigidbody/collider,将在每帧调用OnCollisionStay。
OnTriggerEnterOnTriggerEnter is called when the Collider other enters the trigger.
当碰撞器进入触发器时OnTriggerEnter被调用。
OnTriggerExitOnTriggerExit is called when the Collider other has stopped touching the trigger.
当该碰撞器停止接触触发器时,OnTriggerExit被调用。也就是说,当碰撞器离开触发器时,调用OnTriggerExit。
OnTriggerStayOnTriggerStay is called almost all the frames for every Collider other that is touching the trigger.
每当碰撞器从进入触发器,几乎每帧调用OnTriggerStay。
script/unityengine/classes/collider/collider.txt · 最后更改: 2016/08/02 05:30 (外部编辑)