- Home /
Yet another collision detection mystery
Hey everyone!
I'm currently working on a project where I have a new collision problem (which has become common for me now). I am working with MonoDevelop and VS2010 Unity3D 3.1.0 and C# only.
The situation in my project and scene is as follows:
I have a character controller component on a player, a block scene and an elevator. The elevator has an isTrigger box checked on a component hooked on the elevatorblock. The component with isTrigger active on the block is invisible and the size is roughly that of the block +1 in all directions.
The problem in my project and scene is as follows:
When the collision detection has to take place it only does so if the player with said charactercontroller ( and rigidbody ) Actually makes a move or a form of gravity or falling is applied. A sort of "only bother checking collisions if he is moving" system. That's all nice and performance optimized, but when my character stands still ad gravity is applied you can use the elevator since that force triggers the detection (I think, did some testing not 100% sure though).
The PROBLEM is horizontal movement (Yeah don't ask why it goes that way it just does). When I jump , I can go clean through the side of the elevator, if I stand still on a dummy block on the height of the elevator it also passes through me.
Any idea's on where I should look for a solution?
Thanks in advance! :)
EDIT 10:05 12/2/2010:
And oh almost forgot, I am looking for an answer as to why this is happening, not a solution how to fix it. It is welcome but I am more curious then in trouble and trying to fix a problem :)
Answer by Proclyon · Dec 02, 2010 at 09:28 AM
It seems after more testing that the speed of the elevator causes the problem. Latching child/parent is performing perfectly for top side collisions and the trigger being only on the top. So this quick change in testing has revealed an answer. The +1 in all area's was done to hastily and made it look like the character could pass through part of it. And only fully go through when both object went at each other at their full velocity in opposite direction. I will look into using Continous Dynamic collision detection for fast moving elevators and see if that works.
Going to look for the solution but the answer is: It's moving to fast for discrete detection method.
EDIT 13:10 GMT+1 12/04/2010
The problem was my own construction of sorts. I used a block and another GO with the isTrigger property on it's box collider. It was glued on about all sides of the block extending +1 in all ranges. This detection works fine, however my character had to much fall speed, even though the character did manage to attach itself as child to the triggerblock of the elevator the forced falling effect (home made , not physics based) caused the detachment as child. The problem of the speed was that the effect was so little it would appear as if there was no horizontal momentum, that however was a flawed observation during the test, it just LOOKED to behave wrong, in truth it worked perfectly fine.
Goes to show you again , don't blame the computer, you just end up looking stupid when it proves you wrong.
Your answer
![](https://koobas.hobune.stream/wayback/20220613085355im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Best practice for OnTriggerEnter detection 1 Answer
How to check if car entered garage... then if true, do a specified function ? -1 Answers
Collision not detected 3 Answers
Collision problem in C# 4 Answers
How to Apply a script During collison? 3 Answers