- Home /
Unity collision detection only for raycasts
Hello again. I'm interested in how Unity's collision detection methods work.
The topic states my main question: Is there a way to disable colliders from checking collision against other colliders and instead check collisions only with raycasts.
Why would someone want that, you ask? I have a lot of objects in the scene with colliders and only need them to check against my raycasts. I reckon the performance could improve a lot with disabling the unnecessary checks.
I know that needless optimization is not time best invested in the middle of a project, but this is a question that's been stuck in my head for a while and I see no harm in getting it out of there.
While searching for an answer I bumped in another questions that woke my academical curiosity:
One would think that checking "IsTrigger" on the colliders would improve performance due to being ignored by the physics engine. Instead enabling it for some 30 objects seems to drop the FPS noticeably (not severely though). What's the explanation?
Thank you.
Answer by ExpiredIndexCard · Jul 05, 2013 at 12:57 AM
Do some research on Physics layers and maybe Ignore collisions. Here are some links to get you started: http://www.youtube.com/watch?v=99cnSkMXmdY
http://www.youtube.com/watch?v=wKgKSg0Nr6A
http://docs.unity3d.com/Documentation/ScriptReference/Physics.IgnoreCollision.html
Your answer
Follow this Question
Related Questions
raycasts only working with IsTrigger colliders? 1 Answer
Raycast: OnCollisionStay() detect collision not on Ray but Object? 1 Answer
Using GetPixel via Raycasting Without Colliders 0 Answers
AI Players Movement for Rolling Ball Game 0 Answers
How can I determine how many colliders exist along a line? 1 Answer