Solution For Hide my Actor

I am Trying to find solution for hide camera when camera collide with actor so that i can prevent seeing through my actor but it only works when my actor is moving any solution please?

You want to hide your camera component? I don’t understand, and I’m not sure that makes sense, since the camera itself is not ever visible in the first place.

Let’s start over. When your camera gets too close, like in your second screenshot, what do you want to see happen?

i want my mesh hide so that user can not see through it’s body

Now I get it. Thanks. I’ll post an answer shortly.

I think the reason your approach wasn’t working has to do with the collision profiles of your character’s mesh and that of your sphere collider. It might be tricky to find a combination that allows for an overlap to occur without negatively affecting the character’s typical collision behavior.

So, instead of going about it that way, I found two solutions that worked using other techniques. Have a look:

The screenshot above shows the first way I solved the problem using a very inexpensive squared-distance comparison. Using this approach, you specify the closest distance the camera is allowed to be to the camera’s orbit point (the end of the camera boom), and if the camera gets closer than that distance, the character is hidden. The drawback of this approach is that it might be impossible to find a value that works satisfactorily for all viewing directions. I noticed that a distance of 80 units worked well for hiding the character when the camera was approaching from the side, but it didn’t work as well when the camera approached from the bottom. You could probably interpolate between a couple of values using the camera’s rotation to improve this technique somewhat, but it would never be “perfect”, though it might be “good enough” for most situations.

Here’s my other approach:

This second approach is effectively the same as what you were trying to accomplish, but thankfully it works without having to worry about collision profiles. It takes advantage of the [Get Closest Point on Collision][3] node, which helpfully returns 0 if the provided point is within the collider. So if the return value is exactly equal to zero, the character’s mesh is hidden. The downside of this approach is that it’s not as beautifully inexpensive as the first approach, because it presumably relies on line traces, but this isn’t a problem if you’re not extremely concerned about optimizing your game. Besides, the upside is, it works from all directions, unlike Approach 1.

Hopefully one or both of those solutions helps you out and gets you closer to your goal. Let me know if I can help explain things any better!

thanks appreciated

This one should help TPS Build Part 1 - Camera Setup - YouTube
Instead of using Capsule colliding with Camera, you can make it check colliding with mesh itself, if you tick “Generate Overlap Events” in the mesh