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. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Setting Anchor Points of 3D Objects

Discussion in 'Getting Started' started by anil_unity628, May 19, 2018.

  1. anil_unity628

    anil_unity628

    Joined:
    May 13, 2018
    Posts:
    1
    I'm trying to make a grid of cubes for a 3D game, and render them starting from the bottom left hand corner of the screen. I make my cubes in scripts by instantiating them at run-time.

    cubes.PNG

    Currently my cubes always render from the center of the screen, so I assume this is because they are anchored to the centre of the screen?

    As I am developing for mobile, what I want to do is always render from the bottom left hand corner of the screen. I also want to scale the cubes so that they automatically fit the screen display I am using. I always have the same number of cubes horizontally and vertically, but the screen size could differ.

    Is it possible for anyone to help out a noobie?
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,840
    Yes, you're on the right track. If you want to work from the bottom-left, then make sure your anchors (both min and max) are set to 0 in both X and Y. You'll probably want to set the pivot to 0,0 as well (this determines what point on each cube is positioned at the point you specify relative to the anchors).
     
  3. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,840
    Oh, wait. You're talking about 3D positioning (Transform rather than RectTransform).

    In that case, simply move the camera!
     
  4. AnilDG

    AnilDG

    Joined:
    Jan 10, 2017
    Posts:
    1
    Where should I be moving the camera to?

    I want to ensure it works with any screen resolution.
     
  5. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,840
    You should be moving it up and to the right, so that your lower-left cube is in the lower left corner of the screen.

    For now, just throw up some cubes and move the camera manually. Dealing with different screen aspect ratios is a PITA, and will probably require you to dust off your high school algebra. I recommend you ignore that for now and get on with making a game that is fun to play!