- Home /
Third person tank game: Rotating barrel clips through wall when tank isn't moving, even if I add a collider to it.
I have a third-person tank shooting game. The tank has a barrel, and the player can rotate this barrel by looking around with mouse.
Even though I attach a collider to this barrel, if the tank is absolutely still and next to a wall, the barrel can clip through walls if the player rotates the barrel around. This allows the player to shoot through walls. This problem only happens if the tank is not moving, however; if the tank has even a little velocity, then the barrel will not clip through the wall, and instead the tank will be pushed away, as intended.
The tank itself has a rigidbody attached. The barrel, which is a child of the tank, does not have a rigidbody attached, nor does the wall in which it clips through. I have tried adding rigidbodies, but this did not solve the problem.
Does anyone have any ideas on how to fix this?
I'd suggest unparenting the barrel from the tank and see if it still does not collide. That will at least limit what could be wrong.
It sounds like this might be an issue with Rigidbody Sleeping.
how do you move the barrel? I'd be willing to bet something about moving the barrel is skipping physics