Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Cameras in Confined Spaces

Discussion in 'Game Design' started by awake, Sep 12, 2018.

  1. awake

    awake

    Joined:
    Dec 24, 2013
    Posts:
    49
    Hello,
    So I'm using the Unity 3d Gamekit and the level I'm designing is in sewers. The camera system avoids clipping the tunnel, but the motion of the camera pulling in and out affects the game controls.
    Should i put the camera on rails instead? Any ideas? I like 3d modeling but am at a loss when it comes to 3d game controls.

    https://forum.unity.com/threads/awake.546017/
     
  2. YBtheS

    YBtheS

    Joined:
    Feb 22, 2016
    Posts:
    239
    What do you mean? Like the camera moving affects how your character moves?

    Perhaps that is a good idea. Note that if you do you'll need to make sure that the camera always has your character and the enemy in its view and that the camera never gets too close to one of them.
     
  3. awake

    awake

    Joined:
    Dec 24, 2013
    Posts:
    49
    I think it is common with 3rd person games for the character movement to be relative to camera position. Thanks for the feedback, I didn't think of how awkward the camera on rails could get if it gets too close to the player and enemy. I may have to look at some cinemachine tutorials.

    I'm going to see if giving the user the ability to switch between 3rd and 1st person would help at all, especially since i was already planning on implementing a gun aiming mode.
     
  4. YBtheS

    YBtheS

    Joined:
    Feb 22, 2016
    Posts:
    239
    Really? I've never heard of that. Why not just make it relative to the actual character? Sounds counter-intuitive.

    Okay. But also note that you'll need to design your game with both of those view points in mind. If you have a cutscene where the camera pans to a certain position, you need to make sure that they can both get there. Or if you have a level where some far away building comes crashing down in the background, the third person view will probably have an easier time seeing behind obstructions. In first person, you may not even realize that it's happening. So before you decide to allow switching between third and first person, realize that you'll need to design the game with that in mind.
     
  5. Braineeee

    Braineeee

    Joined:
    Nov 9, 2014
    Posts:
    1,211
    I think the better question to ask is why is your character in the gutter/sewer of all places? What could possibly be of value down there? How many parents are going to see your game and have an adverse judgement about what it is portraying to their children? Not saying parents are always right about games but still. Make it some sort of tunnel instead.

    [edit] You must do something with mathematics to figure this out, of that I am sure, and it isn't difficult just requires some thought. This is called problem solving and its not sustainable to have others solve them for you in a problem solving career (unless you've given it a good try and are stuck).

    What I would do:

    1. Realize the camera distance from the character model is greater than the radius of the tunnel, therefore I must find some way to make this optimal from a gameplay perspective.

    2. Realize that said sewer/tunnel does not need to accurately represent said environment (yuck), instead I could maybe increase the tunnel diameter, and add walkways along the sides for the character and bots. This option has the twofold advantage of making camera action easier, and giving the bots and player character room to maneuver in two dimensions, a gameplay plus!

    3. Make the tunnel tall enough that the player can stand up in it but the camera does not have to zoom forward too much when on the side walkway, but still able to climb out of the muck if necessary.

    Or if I decide not to do this, add a First person camera mode with fp animations, etc.
     
    Last edited: Sep 15, 2018
  6. Braineeee

    Braineeee

    Joined:
    Nov 9, 2014
    Posts:
    1,211
    This may be rather inspirational to you:


    I had a blast with this game as a kid, and as an adult. No sewer needed!
     
  7. awake

    awake

    Joined:
    Dec 24, 2013
    Posts:
    49
    . That’s a great point about the issues with having the player switch views. I’ll have to think about non sewer parts of my game before i make that change. Thanks for the help.
     
  8. awake

    awake

    Joined:
    Dec 24, 2013
    Posts:
    49
    From looking at this and your previous post i see what you mean about fixing the camera. I think the 3d gamekit has the camera really far back which forces the camera to always be colliding. the star wars game has the default much closer to the player. it only zooms in when the player turns with their back right against the wall. I think ill try changing that default position first and see if it smooths it out. by the way i do have walkways in my sewer. I think of it more as a storm drain system than crawling through a sanitary sewer pipe with feces all over.
     
  9. YBtheS

    YBtheS

    Joined:
    Feb 22, 2016
    Posts:
    239
    For story I'd assume. And not every gamer is a child with parental supervision. And why would a parent be upset about a character in the sewer... Teenage Mutant Ninja Turtles is a children's show that had many sewer scenes because part of the story is that the ninja turtles went there to not be seen.

    Unless it's important for gameplay. Say, to prevent the player from just sprinting around all enemies and getting to the end without a fight which could happen if the tunnel is too big and the player can outrun the enemy.
     
    awake likes this.
  10. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    966
    I had a similar problem where I needed an intelligent camera to fit through tight spaces. I solved the problem by creating a trigger box in those spaces that overrides the cameras AI and forces it onto a rail, then let’s it go again once it’s pass through.
     
    Socrates, YBtheS and awake like this.
  11. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    9,904
    Check out the Rise of the Tomb Raider's and the Shadow of the Tomb Raider's camera handling. I think they nailed very good in okay places and in the smallest holes among rocks. They are using rails though in those tight spaces.
     
    awake likes this.
  12. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Sewers are a classic location for video games. They give an interesting excuse to be in a tunnel partially filled with liquid. They are fairly ubiquitous. And they provide convenient connection points between disparate locations without having to provide a narrative reason for underground tunnels.

    I would be surprised if there are any parents groups that actually object to sewers just based on their location.
     
  13. awake

    awake

    Joined:
    Dec 24, 2013
    Posts:
    49
    Technical first. The Cinemachine camera in the Unity 3d Gamekit basically bounces the camera between three locations (top middle bottom) defined by rings. In the confined space, the camera keeps trying to go into these large orbits but is pulled forward due to environment collision. I think i can strike a balance by adjusting the size of the camera orbits to use the existing camera in a tight area. @Braineeee helped me to really look more critically at 3rd person controls. I didnt realize there were so many different types of setups such as that star wars jedi knight locking to the back of the player, to world of warcraft where the camera is free moving but a button press changes the character direction to match the camera.

    I'm also going to look at doing tracks @newjerseyrunner, because they may be good for certain areas to emphasize a certain perspective or build tension @LurkingNinjaDev had some good references to check out.

    Non-Technical. I really find the discussion of using sewers interesting. Thanks for the support @YBtheS and @kiwase
    In the story for the game, the player is forced to escape into a drainage pipe system to escape from a corporation that basically control the city. I have a pinterest full of sewer images. You'd be amazed at how expansive some drainage systems are. It was a way of getting out of the area without showing the city yet. The city streets appear in a later level. The sewer has its own eco system with this giant slug boss and large flightless sewer birds to deal with. I'm a parent with two toddlers myself, and looking at how long it takes to make games i think it will be age appropriate for them by the time im done with a few levels. Just have to fix the protagonist's outfit because jeans would be more normal for the situation.
     
    YBtheS likes this.