The weapon passes through the walls.

Hi, everybody.I have a question.I need to make sure that the weapon doesn’t go through the walls. If the ceiling on the level of spheres the collision of the character and if you raise the camera up,the weapon will go through the ceiling.How to make it not pass through the ceiling?

Try setting the weapon’s collision presets to block worldstatic.


Your ‘failed’ example clearly says that the object has ‘No Collision’.

None of the Collision enabled does not solve the problem.Maybe there’s another solution?For example, in unity you can have one camera that shows the weapon and the second camera display everything else.And that solved the problem.

I solved this problem with the following action:
Simply Set the size of the camera to which the hands are attached to 0.1. The size of the hands and weapons not have changed, and the size of the cameras has changed.Therefore, she has become very small and now not passes through wall.

Also, NearClipPlane must be set to 0 in the project settings or slightly above 0

Here is a great tut on how to adjust collision capsule’s radius when coming near walls.

The capsule’s collision overrides all other objects attached to character’s collisions so that is why counting on the gun’s collision to push against the wall wont work.

I want to know how the person in the above did this amazing piece of work, this is how it should be in all games, does anyone know how to recreate this?

Currently I put the weapons away when they go near a surface however it’s no where near as realistic as the implementation in the video above.

It’s explained by the author in detail in the comments.