
A standard Capsule Collider 一个标准的胶囊碰撞器 Colliders work with Rigidbodies to bring physics in Unity to life. Whereas Rigidbodies allow objects to be controlled by physics, Colliders allow objects to collide with each other. Colliders must be added to objects independently of Rigidbodies. A Collider does not necessarily need a Rigidbody attached, but a Rigidbody must be attached in order for the object to move as a result of collisions.碰撞器作用于刚体使Unity中的物理作用生效。因为刚体允许对象被物理系统控制。碰撞器使对象之间产生碰撞作用。碰撞器必须独立于刚体加在对象上。碰撞器并不一定需要附加刚体,但是要使移动物体具有碰撞效果必须附加刚体。When a collision between two Colliders occurs and if at least one of them has a Rigidbody attached, three collision messages are sent out to the objects attached to them. These events can be handled in scripting, and allow you to create unique behaviors with or without making use of the built-in NVIDIA PhysX engine.当两个碰撞器间产生碰撞并且其中至少一个附加了刚体时,三个碰撞信息会发送给附加他们的对象,这些事件可以被脚本处理,而且允许用户可以选择自己写脚本或使用内置的NVIDIA PhysX引擎创建唯一的行为。
A real-world Compound Collider setup 一个真实复合碰撞器设置 In the above picture, the environment has a Mesh Collider attached. Mesh Colliders work the best for terrain or environments made from irregular shapes. The gun_model GameObject has a Rigidbody attached, and multiple primitive Colliders as child GameObjects. When the Rigidbody parent is moved around by forces, the child Colliders move along with it. The primitive Colliders will collide with the environment's Mesh Collider, and the parent Rigidbody will alter the way it moves based on forces being applied to it and how its child Colliders interact with other Colliders in the Scene.上图中,环境附加了一个网格碰撞器。网格碰撞器用于由不规则形状构成的地形或环境十分合适。枪模型游戏对象附加了刚体和多个原型碰撞器子对象。当父级刚体受力移动时,子级碰撞器也随之一起移动。原型碰撞器会和环境网格碰撞器碰撞,同时父级刚体会因子级碰撞器和场景中其他碰撞器作用产生的力改变移动路径。Mesh Colliders can't normally collide with each other. If a Mesh Collider is marked as Convex, then it can collide with another Mesh Collider. The typical solution is to use primitive Colliders for any objects that move, and Mesh Colliders for static background objects.网格碰撞器通常无法互相碰撞,如果一个网格碰撞器标记为凸起的(Convex),那么它可以和其他碰撞器碰撞。典型的解决方法是在移动对象上使用原型碰撞器而在静态的背景对象上使用网格碰撞器。
Layer-Based Collision Detection 基于层的碰撞检测In Unity 3.x we introduce something called Layer-Based Collision Detection, and is that you can now selectively tell Unity GameObjects to collide with specific layers they are attached to. For more info, you can click here在Unity3以后版本,我们介绍了一种称为"基于层的碰撞检测"(Layer-Based Collision Detection)的东西,可以让你有选择地控制Unity对象和他们附加的特定层碰撞。点击此处获取更多信息。| 欢迎光临 纳金网 (http://go.narkii.com/club/) | Powered by Discuz! X2.5 |