Hi there,
I’ve been weeks looking for what may be causing this, without a slightly idea of what could it be.
I’m using raycasts for bullet hit-testing on a retro-fps game. The odd thing is that common colliders works, when raycasts, after some time of playing, starts to fail here and there.
I’ve tried drawing it’s path, checking frame-by-frame, without any hit of what could it be.
The raycast in this case is checking it’s path against a capsule collider. I’ve tried using Update(), also FixedUpdate(). Tried Raycast, and RaycastAll. On my last attempt, my raycast code is as follows:
RaycastHit[ ] hits;
hits = Physics.RaycastAll(testPos, testDir, mag, bulletHitAbles); //bulletHitAbles is a layermask
When the error kicks, zero hits are returned.
This same bullet hits successfully a static mesh collider later (scenary/walls), after skipping/not-hitting the capsule collider (which is not static, also, it’s not moving or moving very slowly).
While testing, I’ve added other capsule colliders behind this target, and the bullets hits those capsules without any problem.
While testing, I’ve removed the Physic Material that was set on the capsule collider of this target, and the shots were successful again. But I’m not sure if it’s related, or if it was luck, since it’s very hard to replicate this case.
Do someone knows what may be going on? I’m almost sure that Physic Material is not part of the hit-testing. Maybe the surrounding mesh colliders trigger some unexpected cases?
Is there any possibility of debugging deeper into the raycast itself?
Thanks,





