Download

Making the camera independent of the player

Quick question… How would you make the players movement independent of the camera while staying within the borders of the frame. Like an on-rails third person shooter.

Not quite sure I get what you mean. Do you mean you want the control direction to be relative to the character’s orientation rather than the camera angle (as in: press forward to make the character move into the direction they’re facing, rather than into the direction the camera is facing)?

Do you mean something like the super smash bros brawl camera where it moves the camera towards the player when he is outside of a square positioned on the center of the screen - but in 3d space?

so you mean you can walk inside the frame with out the camera to actually move but when you try to leave the frame, the camera gets dragged with you so you never actually leave the frame? disable all the control rotation functions in the cam. the camera shouldn’t be below your mesh in the component hierarchy. that should do the first part I think.

Yes, you have the right idea. Although, the camera angles will ultimately be predetermined sort of like a Star Fox game. So what you are saying is get rid of the camera rotation nodes in my blueprint? What would I replace them with to create the sort of presentation I’m looking for?

Anymore tips? I can’t really move on until I get these things figured out. Any further help would be appreciated.

Mesh is inherited, and I can’t seem to be able to reorder where the camera is.

you would have to rewrite the character.cpp file. other wise try to make 2 separate pawns. one is just a camera and this camera pawn controls a second pawn indirectly. I thing that’s the easiest way to achieve what you want. its would be basically like a RTS game but with only one pawn and with normal movement input. inside your camera pawn you could check permanently whether your player pawn is out of frame or not. if he is, reposition your camera pawn

How would you change the camera into a pawn? I’m not very versed on the camera controls with player characters, sort of why I’m here, lol. This is sort of what I got, if you need more I can take more screens.
6ab04071a307930ef8152f874b55e462a65246f9.jpeg

nono I mean, make an empty pawn and only add a camera. then you have a second pawn which is your character. basically 2 different chars. the camera pawn gets a reference to the second char pawn and can move him like a puppet but it will feel like you would directly control the char pawn. so you would make all the movement like : “W” Input -> get Char Reference -> Add Movement Input / or what ever.

you could also event tick the char pawn location and check whether its on screen space. if not -> move your camera pawn so you can see the char pawn again

I’ll try this, and see how it works out.

Ok now I see what you were getting at now that I have more time to look into this. This is how it would work if I wanted the camera to pan left and right. Although most of the time the camera will constantly be moving forward through 3D space, so how would I achieve this?

After watching a tutorial on camera cinematics I just thought of something. Is it possible to animate the camera’s forward movement so I can get the on-rails functions, and then I can control the characters left, right, up, down movement separately. Then the only thing left I would need to figure out is how to check when the player moves out of frame, and then change camera position accordingly.

event tick the chars location and convert it to screen space. if its in the screen boarders do nothing. otherwise change cam position

I found what I was looking for here http://www.unrealenginetutorials.com/character-follow-a-spline-component-unreal-engine-4/,Zarkopafilis referred me there because that is what I was looking for is how to move the character along a spline. I’m going through the steps now to set it up, but I’ll see how it works out.