Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Camera restriction to position 2.5d

Discussion in 'General Graphics' started by unity_8EED3EEDD57DBE7268FD, Sep 1, 2023.

  1. unity_8EED3EEDD57DBE7268FD

    unity_8EED3EEDD57DBE7268FD

    Joined:
    Apr 12, 2023
    Posts:
    1
    What might be the solution, that camera view will not go beyond certain object on left and right, top and bottom. Basically it will stays within certain bounds. Gamer might have monitor with different aspect ratio, so this shouldn´t be some fixed number. Any opinion about it or suggestion for plugin? Thanks, if you spare insight on this. :)
     
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,727
    You got 3 options.
    - Either stretch the screen. Which will look bad.
    - Clamp aspect ration, which will look bad.
    - Making sure, your scene is wide and specious enough so wider, or narrower aspect ratios are not an issue.
     
  3. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,028
    Except there's a 4th option. Calculate the world space position of the corners of the view frustum and clamp camera movement to keep any of those from going out of bounds. Which will look fine because it's now handled procedurally.
     
  4. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,492
    Program it. Compare camera movement with restricted area, clamp it if it tries to go beyond.

    If a gamer decided to play 2.5d game on 320:9 monitor, that's his problem, letterbox it with black area at the sides.