- bounceThreshold
- CapsuleCastAll
- CapsuleCast
- CheckCapsule
- CheckSphere
- GetIgnoreLayerCollision
- gravity
- IgnoreCollision
- IgnoreLayerCollision
- Linecast
- maxAngularVelocity
- minPenetrationForPenalty
- OverlapSphere
- RaycastAll
- Raycast
- sleepAngularVelocity
- sleepVelocity
- solverIterationCount
- SphereCastAll
- SphereCast
Physics.IgnoreCollision 忽略碰撞
static function IgnoreCollision (collider1 : Collider, collider2 : Collider, ignore : bool = true) : void
Description描述
Makes the collision detection system ignore all collisions between collider1 and collider2.
使碰撞体1和碰撞体2的碰撞侦测无效。
This is most useful for making eg. projectiles not collide with the object shooting them.
如果要忽略炮弹和发射物之间的碰撞侦测,这种情况下是很有用的。
IgnoreCollision has a few limitations: 1) It is not persistent. This means ignore collision state will not be stored in the editor when saving a scene. 2) You can only apply the ignore collision to colliders in active game objects. When deactivating the collider or attached rigidbody the IgnoreCollision state will be lost and you have to call Physics.IgnoreCollision again.
忽略碰撞情况下的限制:1. 保存场景时忽略状态不能保存。2.只能在活动的对象物体上应用。如果用在失效的物体上,必须要调用一次physics.IgnoreCollision.
参见: Physics.IgnoreLayerCollision
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public Transform bulletPrefab;
void Start() {
Transform bullet = Instantiate(bulletPrefab) as Transform;
Physics.IgnoreCollision(bullet.collider, collider);
}
}