- Home /
Triggers not working because of speed?
Hello, I've been trying to figure out why my colliders are not working. The moving object (cube) has a rigidbody that is not kinematic, and it has a box collider of its own Not set to trigger.I have a wall that only has a mesh renderer, a mesh filter and a box collider set to trigger. So why won't it work? This is the script on the wall:
function OnTriggerEnter (other : Collider) {
if (other.gameObject.tag=="new"){
//if (other.gameObject.CompareTag=="new"){
Debug.Log("object passed");
pass +=1;
I think it is because of the speed. The script on the cube makes it go 1000f, so my question, is: is my collider not working because of the speed? Thanks,
P.S. The rigidbody is set to discrete detection.
change collision detection mode - discrete to continuous Dynamic
Answer by troien · Nov 24, 2014 at 10:41 AM
Well, if the problem is ineed due to the high speed. This post should help you further.
Sinse it includes how you can detect whether this is the case. And the things you can do to resolve this problem.
As @sumit9236 pointed out, changing the rigidbody's collisionDetectionMode to ContinuousDynamic might help aswell.
changing the detectionmode didn't help, and according to the other post, he mentioned that the detection happened if it was going at a slow speed. I changed my scripts to create a slow object, but detection did not happen. $$anonymous$$y objective is to have the wall count how many object go through it. Perhaps there is another way?
How do you move your cube? The Rigidbody reference page states that you should do this in FixedUpdate ins$$anonymous$$d of Update. (To prevent all sorts of problems, maybe some linked to yours).
And is the tag of the other gameobject "new"? :p
According to the setup you gave me, there couldn't really be a problem that I know of other then that your cube moves to fast. For which the answers given in the post I linked still work best. (Reducing te Fixed Timestep being the easiest).
I tried your setup in a test scene, where the only way I was able to not get the log was when I moved my cube to fast or when I forgot to set the tag of the cube :p
Your answer
Follow this Question
Related Questions
Ideas for detecting collision speed with trigger? 2 Answers
Increase speed of object that enters OnTriggerEnter 1 Answer
How to move an object back/forth on a set path? 2 Answers
OnTriggerStay weird behavior 0 Answers
Internal collisions 1 Answer