Download

Camera "Zone" around player?

I’ve been messing with the camera component on my character BP and I’ve yet to come up with an elegant solution.

I’m working on a third-person game that’s part action/brawler and part shooter. What I’d like is to create a camera “deadzone” around the player’s current location, so that when the player moves left and right, the camera remains fixed in place, but if they move far ENOUGH left or right the camera slides along with them. In effect, the player can move left/right within an invisible bounding box, and moving beyond that point drags the bounding box (keeping them on the edge of it).

The reason for wanting to do this is the shoulder problem in TPSes; if the camera is centered, seeing what you’re aiming at is difficult. But, since the game is also an action game and the player won’t be shooting constantly (and can turn freely unless they’re shooting, which always targets the reticle), having the player always be fixed off to one side would look strange. So I want to let the player move freely left/right a little ways without the camera adjusting, so they’re less likely to ever be dead-center and blocking the reticle.

The camera boom can be set to follow the player with a delay but in the end it always snaps back to dead center, there’s no boom “dead zone”.

Any ideas?

I am not quite sure if this approach will work, but you could try setting the mesh (not the actor!) to another location based on the actors right vector. I would imagine the flow somewhat like this:

  1. Right axis movement input starts
  2. Check if the mesh was moved a set distance (e.g. 300 units) to either direction (left/right)
    -> true: proceed to 3)
    -> false: move the mesh a little bit to the desired direction (so we don’t just teleport it to the maximum distance), proceed to 2)
  3. The mesh was moved the set distance, now move the actor to the given direction

I cannot really test this right now as I am not at home, but if you need any further help I could try throwing something together once I get home. Oh and you might also need to consider any special cases, like no animation playing when only moving the mesh etc.

Good luck!

You could also try offsetting the boom in a negative direction to the right axis input up to a max distance?