As you can see I added capsule to colliide with Anything in front of it.
I set this capsule to be visible and it visibly overlaps walls, like it doesnt have any collision.
It is not only the wall, it also overlaps other player’s head when I stand close.
I would like to know how do game developers usually deal with these kind of issues. I don’t think the method I am going with is the smartest.
These cube options and weapon options were found inside UE documentation.
Cube is, with these options, just like a trigger(you can go through it), and I set everything again to BLOCK ALL so its like a real block but i still have my weapon overlaping it…
try going over this one. Collision | Unreal Engine Documentation
oh wait a sec, what about collision in the player character after you “pickup” the gun thats a different set of physics options again.
Ok, I will remove collision from Pistol completely. I want that second capsule, on screenshot at the top of the page, to have collision… When it touches wall it just stops character.
-I was trying to use OnOverlap and OnEndOverlap event and It worked, but when i come slowly close to the cube it stops character but if i run into cube then my weapon goes through wall again
So now we only need to focus on that second capsule in Viewport.
unfortunately the overlap events aren’t blocking, unless you called an action to then block based on its output.
i would recommend shrinking it, and taking it outside of the main palyer collision capsule to avoid colliding with the player. then you can at least test the other modes. but you may not be able to use the collision presets, and might have to go through the tick boxes of blocking/overlap on the guns capsule to find the right one.
there are only 6 to choose from, and only 4 that would be used in this case. worldstatic/dynamic/pawn/physicsbody
and try turning off “generate overlap events” if its turned on.
sorry my answer may be a little fuzzy.
you would need to do a get of the capsule and then set its collision state
you can use “Get Capsule”, then “set collision” on the output.
I have been trying to make this work the whole day, still got nothing…
This is what i did :
I opened project settings, created new object channel called “PlyrCapsule”.
In Player BP in viewport i set second capsule’s object type to “PlyrCapsule”.
Then in Cube’s Collision i set Custom collision to block “PlyrCapsule”.
My weapon still overlaps the wall.
Once again: I removed collision from my weapon.I put capsule further from me as you said, for avoiding colliding with player(even if I could set overlap properties in collision). And this is going to be simple Multiplayer Game. For that reason, I can’t shrink my weapon. Maybe I could make the weapon shrunk for individual players, but for other players the weapon would look normally sized. Though, other players would see the weapon overlaping from another player (which is tha main reason I want to fix this, as it can be used to “cheat” by seeing someone else’s gun peaking through wall)
I got around this issue by attaching a spring arm to the first person mesh so that it moves back when you get near walls. Collision is limited to just the capsule for all characters so the only real way to do what you’re trying to accomplish is to edit the source code for the character BP or create your own pawn from scratch.