- Home /
Why isn't continuous collision detection working on terrain?
I have bullets that clip through terrain when they're on continuous collision detection. The collisions register normally if the bullet moves very slowly or if I'm lucky, but even though I have collision detection set to continuous, it clips through easily in most cases. Why is this?
Answer by BenKurdziel · Sep 30, 2014 at 01:49 AM
Without seeing any code, my only advice would be to make sure you're not using Transform.Translate, because that will ignore collision.
Generally, bullets are handled by a raycast forward and detecting if it hits something, showing a muzzleflash, and if it hits an enemy, removing some of their health.
If there's a reason you specifically NEED bullets as projectiles, it's generally a good practice in my experience to apply a force to them when you create them and let them be.
Thanks man, and yes, I do use translate. Crap. Guess I'll be writing my own simple raycast/stepwise collider after all! I'll just raycast between current and previous location, or use a for loop to cause it to translate in small increments and detect collisions at each step.
Amazingly enough, I can really see how translate would mess up collision detection by the physics engine, since to it the translate is basically a teleport.
Your answer
