collider

Collision Detection for fast moving game object in Unity [duplicate]

萝らか妹 提交于 2019-12-02 20:53:43
问题 This question already has answers here : How to prevent colliders from passing through each other? (7 answers) Closed last month . I am working on building a basic space shooter game but am having trouble with a trigger collider. In the game, I have a Bullet prefab that has a Capsule Trigger Collider attached to it and the enemy is right now a basic cube with a box collider attached to it. When I run the game I start shooting the bullets and the Enemy cube doesn't disappear until after a few

Collision Detection for fast moving game object in Unity [duplicate]

假装没事ソ 提交于 2019-12-02 11:56:21
This question already has an answer here: How to prevent colliders from passing through each other? 7 answers I am working on building a basic space shooter game but am having trouble with a trigger collider. In the game, I have a Bullet prefab that has a Capsule Trigger Collider attached to it and the enemy is right now a basic cube with a box collider attached to it. When I run the game I start shooting the bullets and the Enemy cube doesn't disappear until after a few shots. Here is my code for the bullet prefab: void OnTriggerEnter(Collider col) { if (col.tag == "Enemy") { Destroy (col