How to make camera not go down when player crouches? (solved)

I asked a question the other day about a camera actor moving with player but not parented to player.

Everynone tried to help me and his solution worked, but for some reason I had trouble replicating it myself. So I went back to that original camera actor idea. I got it to work. Now the problem is, I do not want the camera to move down when the player crouches. This way this setup could do a fighting game and a side scroller.

Thanks for any and all help.

On the left side of editor window there is panel with objects hierarhy. There is camera attached to “camera arm” object. Move camera arm object (together with camera) up in hierarchy and attach camera arm to collision capsule.

Thanks for trying to help but this is a separate camera actor that moves when player moves. But I was able to fix it, just referenced the character mesh and not the capsule component.

Now…if I can figure out how to make it not move when the character is jumping…

Try something like this:

  • In player character Create enumerator with all states you want for player
  • expose it to other blueprints
  • in camera pawn/actor read its value
  • then apply this small code piece to calculate correct offset

I want to try this, but I do not know exactly what those two nodes are after the cast, the third seems obviously a promoted to variable (float), what are these first two nodes after the cast? Thanks.

If you edit ThirdPersonCharacter and add there variable, then first node after cast to reads that variable from ThirdPErsonCharacter.

Second node is Select, if variable that you created in ThirdPersonCharacter is enumerator, then you can use select and assign float value to ever enum value.

What kind of enumerator though? There are many to choose from.

The way I do this is actually in the character blueprint itself. I never use the crouch function. Instead, I create a Boolean isCrouching? And in the animation blueprint, get that and set it to a new Boolean for the animation blueprint. The character now crouches, but the camera stays the same.

It is not hard to make the camera be an observer inside the the character blueprint. If you are using a spring arm, there are checks to inherit character movement, and I think on the camera itself as well.

You can make 2 cameras and then switch between them when you crouch and uncrouch.

I used both Crouch in character and also a variable.

Thanks all who replied, I appreciate it.

I was able to get it to somewhat work, if the player just does a flat footed jump straight up, but if there is any movement left or right the cam stops and as soon as the player touches the ground the cam warps to the new position.

I’m not sure how to solve this problem, the is falling bool and branch can stop cam movement if player is in air, so thus the Z, I guess I need to have the cam keep moving in the Y, but I’m not sure how to go about that here, I had thought perhaps just use another setactorlocation node just for the Y, but for some odd reason that does not work.

If anyone has any insight here it is appreciated, thanks.

(post deleted by author)