Box collider triggers interfering with rigidbody movement

Ladies. Gentlemen.

A good bit ago, an interesting issue had suddenly arisen. There was something interfering with the movement of my character (Who has a rigidbody). I really had no idea what was going on, but I finally discovered the cause the other day. For some reason, the colliders that I’m using as attack hitboxes are the source of the issue. Of course, they’re set as triggers.

It’s the most annoying thing; rigidbody.velocity only actually works in one direction (Can’t go up or right. Only left), the character sometimes gets stuck in one of the colliders, etcetera. Even if I’m nowhere near any other colliders, the issue persists. I had tried messing with the physics settings as well, but if they ignore collisions, then they’re useless as triggers.

So what’s going on here? If a collider is set to trigger, shouldn’t it be unable to mess with objects?

Yes, colliders with isTrigger = true will not interact with physics objects (physically…).

Check the rest of your setup and code, it has to be somewhere else.

If you’re using the Character Controller, you’re a victim of the “added colliders bug”: if you child to the Character Controller some object with a collider, the controller movement becomes very weird: some directions are blocked, or it strafes when trying to go in some directions, or moves to the wrong direction - all depending on how the childed collider intersects the capsule. If this is the case, avoid the added colliders to touch the Character Controller capsule. Setting Is Trigger in such colliders also solves the problem, if it can fit your game logic.

FYI- I ran into this problem as well:

Never figured out what was doing it, but one day it just stopped. I’d been working in a totally unrelated part of the game, so there’s no way I ‘accidentally’ fixed it. My guess is that it’s a rogue bug in Unity… I haven’t figure out a way to reproduce it in a sterile environment. I would recommend sending your project files to Unity to examine (if you’re able to). From my experience it is extremely frustrating, and the fact that it just came out of the blue and disappeared the same way is very concerning.