Hi guys, I’m trying to make a camera for a third person shooter and of course I don’t want it to go through walls and obstacles.
The approach I’m using is to attach a sphere collider to the camera positioned between the camera itself and the character, so that nothing gets in the player’s view. I know that the most common approach to this is to use raycasts or spherecasts, as in the Standard Asset’s FreeLookCameraRig, but it seems to add more overhead than I want a camera to have, so I’m not really happy about it and I was looking for alternatives.
I know Unreal Engine has what they call a Spring Collider that applies a repulsive force to the collider from whichever object it is set to follow. So I thought perhaps Unity’s Spring Joint may be a valid equivalent to that.
I never used it before, so at the moment I don’t actually know how to properly set it up, but do you think it is suitable for the job?
The camera I’m using is similar to the FreeLookCameraRig, so it is a child of a pivot GameObject that rotates the view, which is itself a child of an object that follows the character.