How to set up collision for the camera and actors?

I’m creating a scene in UE5 and trying to film it using a camera, but I’m facing an issue with the camera’s behavior. I’d really appreciate any advice you could give.

The problem that I am facing now is when I move the camera, it can pass right through actors in the scene such as trees or rocks without any issue. I’d like to prevent this and make the camera collide with these actors. Could you tell me how to set this up?When the camera collides with an actor, I don’t need any actions like bouncing back or camera shake. I just want the camera to stop moving forward at the point of collision.

Currently, the camera is attached to a Spring Arm, and in the detailed settings under Collision, the “Do Collision Test” option is checked.
The actors placed in the scene have their collision presets set to either “Default” or “BlockAll”.

The camera actor needs a collision primitive, try making its root a capsule component and set up it’s collision response according to your needs and try that.

1 Like

@ROFLMAST3R
Thank you for your kind advice!
I tried adding and setting up a Sphere, but even after compiling and saving, the camera still passes through the actors when I move it. If there’s anything else that might be causing this, I’d appreciate it if you could let me know.

First thing is try making the sphere collision the scene root. Additionaly, how is the camera being moved around? Can you post that code?

1 Like

I realized that I didn’t fully understand some of the basics, but with the help of advices, I was able to research further and make the necessary adjustments. In the end, I successfully resolved the issue! Thank you very much!

  1. Change the Blueprint class that includes the CineCamera from an “Actor” to a “Pawn”. As @ROFLMAST3R suggested, set a Sphere Collision as the Root component. For reference, I’ll leave a note of my component setup here:

BP_CameraPawn(Self)

Sphere
SpringArm - CineCamera
FloationgPawnMovement

2.In the details panel of each component, I checked the following items:
BP_CameraPawn(Self) :check_box_with_check: Use Controller Rotation Yaw
SpringArm :check_box_with_check: Inherit Pitch/Yaw/Roll
CineCamera :check_box_with_check: Use Pawn Controller Rotation

  1. In the project settings under Input, I added WASD and QE to the Axis Mappings, and added nodes in the camera Blueprint to call each Axis Mapping.

  2. In the Static Mesh Editor, I added an auto convex collision to the static mesh. For the landscape, I set the Collision Preset to Custom and changed the Object Type to Pawn.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.