Please help me add collision to my camera

I have a BProlling template game that uses a “3rd person type” of camera rotation.

Problem is when I move the camera around, it clips through everything… I can’t get it to stop.

Camera blocking volume does not block the camera.
Do collision test messes up my camera to the point where it’s 1st person and not 3rd person, can’t figure out why.

Any ideas? I am not good with blueprints at all :frowning:

you may not have collision enabled on the object.
The camera should be testing against the Camera channel.

You can see here how to open up where the collision channels are.
And you can change any default preset to Block the camera - if the issue is global / your items all have the same preset applied.

Was just doing some experiments and camera collision seems to work automatically if attached to a spring arm.

  • attach a SpringArm to controlled Character
  • attach Camera to SpringArm

Camera collision should work with no special settings changed. This is the code for it in third person character constructor:

 // Create a camera boom that pulls in towards the player if there is a collision
 // The camera follows at this distance behind the character
 // Rotate the arm based on the controller
 _cameraBoom = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraBoom"));
 _cameraBoom->TargetArmLength = 250.0f;
 _cameraBoom->bUsePawnControlRotation = true;

 // Create a follow camera
 // Attach the camera to the end of the boom and let the boom adjust to match the controller orientation
 // Camera does not rotate relative to arm
 _followCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("FollowCamera"));
 _followCamera->SetupAttachment(_cameraBoom, USpringArmComponent::SocketName);
 _followCamera->bUsePawnControlRotation = false;

I see another issue, the camera isn’t actually socketed. Click the camera, find the socket field, click the lens button and select a socket.

Hey guys, that was none of the issues. There was collision on everything, the camera was socketed, etc.

I figured out the problem. It wasn’t my fault, but rather how poorly Unreal Engine handles physics on small objects.

My marble was about a couple cm in diameter. When you have a player on such a small scale, you cannot prevent clipping.
Doesn’t matter if you change the clipping plane to 100000, 0, or -10000. It will make no difference to unreal. It can’t handle the camera at such small scales.

Once I scaled my marble up 10x, the clipping all went away. Unfortuantly I had to scale the world up 10x as well which caused a huge issue with lighting, as everything is always too dark now.
It sucks but until there’s a special functionality in Unreal that lets you deal with games on a much smaller scale, this is the workaround.