Unity3D

来源:互联网 发布:银河证券量化交易软件 编辑:程序博客网 时间:2024/05/29 19:15

转自RigidBody vs Collider


You can indeed have a collider with no rigidbody. If there's no rigidbody then Unity assumes the object is static, non-moving. Unity does not bother testing for collisions BETWEEN static objects. As you can imagine, this is very efficient if you have lots of scenery the player can bump into.


So the purpose of having a kinematic rigidbody, rather than no rigidbody, is to turn on collision detection between this object and all other colliders in the scene (even the static ones.) Effectively you are letting Unity know that this object moves around, so Unity will then do collision-detection between it and everything else.


(If you had a game with only two objects in it, and both move kinematically, in theory you would only need a rigidbody on one of them, even though they both move. I haven't tried it. But now imagine three such objects- you'd have to have rigidbodies on two of them. So in practice you'll usually just put rigidbodies on everything that both moves and collides.)