Limiting the distance between a camera's spring arm and third person character upon collision with floor ONLY?

Reubnick
Wed, 06 Apr 2022 03:46:21 +0000
Character & Animation

I am really close to figuring this one out but I seem to be missing the final step.

Here’s the thing - my character is a flying character that also walks and swims. I am trying to figure out how to have free movement of the camera’s pitch while the character is in flight (I.E. you see above him and below him to help determine his flying direction) but to set a pitch minimum and maximum for the spring arm that reacts to floors and collision volumes only. As it stands, I have the first part how I want it. It’s perfect when my character is in flight. But when he is walking or floating, when the camera collides with the floor or water surface the spring arm pushes the camera closer to the spring origin so much that it clips inside of my third person character and it looks terrible. I would like to set it so that when it collides with the floor it pushes it closer to the spring origin but only to a certain distance where it stops before it clips into my character. I want it to not go beneath the floor or water surface and I also don’t want it to clip into my character.

I know how to accomplish both of these things:

When there is a ground or surface underneath my character: Get Player Camera Manager —> set ViewPitchMin and set ViewPitchMax, and that works how I want it to.

When in flight, I just don’t have those restrictions and it works how I want it to.

What I do not know is how to set this up so that I can have both things available and where the camera is conditional and reacts depending on whether it is colliding with a floor/surface or not. No pitch restrictions if the camera isn’t touching anything (flight). Pitch restrictions if it is (floor).

I hope I have explained this well enough. Is there any way to do this?

1 post - 1 participant