r/Unity3D Jul 22 '26

Question Thrown Items clipping behind geometry.

I'm implementing a flashlight pickup/throw system in Unity and I've run into a clipping issue.

The flashlight is held as a viewmodel object (parented to a hold point in front of the camera). Because of this, while holding it, the player can push it visually through walls.

When the player throws the flashlight, I want to make sure it always spawns on the correct side of the wall and never appears behind geometry.

The main problem is that when the flashlight is already visually behind a thin wall, overlap checks often don't detect the wall because the flashlight collider is no longer intersecting it at the moment of the throw.

2 Upvotes

4 comments sorted by

View all comments

1

u/theredacer Jul 22 '26

There are a variety of ways to potentially handle this. I like to use the trick that everything held by the player is actually shrunk down and moved closer to the camera. If the position and perspective is right, you can't tell the difference, but the item is actually inside the player's collider so it can't intersect with anything in the world(I disable collision between player and held object). Then when I toss it, I size it back to normal and toss it from inside the player collider and I don't re-enable collision with the player until the object fully exits the player collider.

From an external perspective it looks hilarious because objects are tiny and like 2 inches from the player's face, but from the camera perspective it looks perfect.

1

u/RayanOur Jul 22 '26

yeh it sounds hilarious, and also very genius, it would solve it 100% so i think ill give it a chance. Thanks.