I have a character and camera actor facing that character as shown below.
I also have a directional light which changes its Rotation based on user input. When the directional light’s direction is parallel to the camera, the camera is blocking some of the light rays and casting a shadow on the character which is physically plausible (as shown below).
However, I would like the camera to be completely transparent and not block any light. I understand that this is not physically plausible and but would still like to do it. If I was dealing with a point light, I would just relocate the point light to be in front of the camera to deal with this use case, but this technique will not work for a directional light.
Actually, the shadows were not being cast by the camera. A default pawn was being spawned when the game started which was casting the shadow. Destroying the default pawn fixed the issue.
I did the following in level blueprint, maybe there is a better way to do this in C++.
The DefaultPawn is not your enemy! It just needs to be configured.
The DefaultPawn class is set in your GameMode via the DefaultPawnClass variable.
You should set the DefaultPawnClass to the class of your player’s character/pawn class, or, if you don’t have one (though it’s unlikely that you’d have a good reason to), you can set it to the bare Pawn class to avoid having the floating sphere appear.
Thanks for the reply! I tried to set the DefaultPawnClass to Pawn and None by following this but the shadow was still there.
I understand that there might be some unintended consequences of deleting the Default Pawn, but I am not really building a game and hence don’t have a Pawn Class to use for that field.
If you set the DefaultPawnClass to Pawn, then there cannot be a DefaultPawn being spawned.
Are you sure that you’ve set that GameMode you’ve set up to be the one used by the World?
There aren’t really any consequences to setting the Default Pawn to just be Pawn, it’s just a convenient way to streamline game design. However, it still isn’t right to delete the DefaultPawn when you can prevent it from being a problem in the first place.