- Home /
Collider Error[SOLVED]
Hello, i think that Unity Colliders have an error when have to detect objects in high speed.
One example, im my game, i have bullets, and they are passing through my object, when is suppose to detect and destroy itself with this script
void OnCollisionEnter(Collision collision) {
//detecting collision with the enemy
if(collision.collider.tag == "Enemy")
{
Destroy(gameObject);
}
}
Here is a picture of what's happening
He's using OnCollisionEnter, not OnTriggerEnter, just to clarify, you'd want IsTrigger to be FALSE in this case.
Yeah. Thats why I said to check if he accidentally turned it on and didnt notice. :)
Answer by clunk47 · Oct 30, 2013 at 12:56 AM
Rigidbodies moving at high speeds should have their CollisionDetectionMode set to ContinuousDynamic. The bodies that these fast movers will hit, should have their mode set to Continuous. Read the Documentation for more information. I'd personally suggest using Raycast on your bullets instead.
Always happy to help. Please accept the answer of these two that helped best resolved your concern.
Your answer
Follow this Question
Related Questions
Collision Detection without a RigidBody 2 Answers
destroy touch the screen on gameobject in camera 0 Answers
How do I stop an immediate collision with all objects from ocuring at the entry of game mode? 0 Answers
C# Check If Gameobject is within Collider 1 Answer
How can i check if GO collided with collider starting with name (string) 1 Answer