I wanted to stop the camera from being blocked only by characters but still be blocked by environment actors, and I did managed to achieve that (inside the character I set ignore camera collision), but now because it isn’t blocked by characters anymore, it can go through them and you get this:
And well, technically it does what I expected and the character is hidden when it touches it, but the character is also hidden on the other side client/server, so this isn’t a solution.
In that video he goes over how to stop the camera from going though the environment which it isn’t a problem for me. As I said I made the camera to be blocked by everything except the characters, but now the camera can go inside them and show the eyes, the mouth… I want to somehow hide the character when the camera is inside them.
I don’t want to block the camera with the characters. And I did that already. The problem that I have is that you can see inside the character, and I want to stop only that and hide the character, but not block the camera.
This isn’t really a feasible approach. Not only that you need to buy a plugin but you also need to change the materials of the characters, which each of them have more then one material (head, chest, legs, accessories…).
The first style of the plugin you can’t use because it only makes the material transparent, but not invisible, so the eye for example will still appear but transparent.
The second style isn’t supported for SkeletalMesh.
And for the third and forth style you need to change the materials.
Don’t get me wrong, maybe the 2nd option you posted would work, but that isn’t something someone without a revenue from other games/project can use. Yeah a big company can buy plugins, but for someone like me that approach isn’t feasible. I can’t simply spend some money on each problem that I may have to simply buy a plugin to fix it or make things go faster, or whatever else.
And like I said, this approach is the one I’m after, so that the camera doesn’t get blocked, but I need to find a way so that characters near the camera in a range aren’t showed. You don’t just have to stop at “well camera goes inside the object and that is all, it will show the inside”. There are ways to go about it.
In a single player situation this would have been easy, as you wouldn’t have cared if that actor simply disappears as it would be out of the players view, but in MP scenario you are making someone else character invisible, which will show for everyone, and not just you.
I’m already quite deep into development, and I have tons of ideas for it. If by the time I’ll publish the game I won’t find a solution to this, then I’ll leave it like that, and maybe I’ll add a patch that fix it. I won’t let something as simple as this to stop me, and any future problem I’ll keep try to find a way.
Unfortunately this is replicated, I tried it already as I seen somewhere that the root shouldn’t be replicated, but it is (maybe it was added in 5.0, as the post I read was pre 5.0 release, or maybe they confused it with normal actors, and not characters, but I didn’t need it for those types). It would have been nice to have the option of choosing if we want stuff to be replicated or not. Changing the location of an actor is replicated, but changing the scale isn’t, like that isn’t important, and you have to make your own way to replicate that (at least that is really easy to replicate, the scale I mean).
Inside the character add a Box Collision that is attached to the camera (I named it “CollideMesh”) so that it moves with it:
Set the Collision Presets of the box to OverlapOnlyPawn.
Inside a Graph create the event On Component Begin Overlap, and in it first check if the owning (self) character of the box that triggers the overlap is locally controlled. You need this check because if the overlap is triggered on the server side, then it will run only on the server, but if the overlap is triggered from a client, then it will run on that client as well as on the server, but you only want the character to disappear locally. After the check, cast the Other Actor to Character (because the box is set to collide with Pawns only, they will have the top parent type Character), then get the mesh from the character and use Set Hidden In Game true.
Now inside the Graph do the same thing for On Component End Overlap, but this time at the end set it to false.
Set the scale/location (Transform) of the Box Collision to which value you want/need to change at which distance from the camera it will hide/show the character. I recommend that the scale from behind the camera to be bigger then the one in front, as the character will be behind the view of the player so he won’t see any difference, but it will make sure that you don’t get into the problem of the scale being too small and not hiding the character properly.
This doesn’t work while character is standing in place, or in other words if you are moving your camera around while standing still, because the collision attached to the spring arm isn’t considered as “moving” and won’t call overlap until character moves.
Correct alternative to this problem is to calculate distance between camera component and mesh component on tick, and when this distance is lower than your threshold, hide the mesh.