Author Topic: Anchor question  (Read 1477 times)

johntygtn

  • Guest
Anchor question
« on: September 12, 2013, 07:04:50 AM »
Hey there. Have a bit of a problem with anchor points.

I am building a game where there needs to be icons that track across the whole bottom of the screen for life indicators. I am doing this by having children of the bottom left, and bottom right anchor points. They are so I know set offsets from the left and right sides of the screen.

It is set up so that the iPad retina is the max resolution.

UIRoot
Scaling Style: Fixed Size
Manual Height: 1536
Min Height : 320
Max Height: 1536

With the 4:3 ratio of the iPad it should make the screen width for retina 2048 and the anchor points should be +/- 1024. When I debug log the localposition.x of the anchor point it gives 1152, even though the inspector is showing 1024. Any idea why it is doing this? It is throwing out my calculations and causing the icons to think the screen is larger than it is.

Cheers,
Johnty.


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Anchor question
« Reply #1 on: September 12, 2013, 08:05:59 AM »
When you are doing this kind of debugging in the editor, you're limited by the game window's size. Since I highly doubt that your game window is actually 2048x1536 pixels right now, your values are going to be smaller.

johntygtn

  • Guest
Re: Anchor question
« Reply #2 on: September 12, 2013, 08:30:34 AM »
While that is true the same error can be seen on the iPad4.

The icons are outside of the screen. as I am using a simple lerp from one position to the other and there is no way that the lerp factor can be > 1 or < 0, I don't think it has to do with the Editor screen size. nay other suggestion? The anchors believe they are larger than they should be. I know that my editor window is about 750 px so if anything it would calculate the anchors to be smaller.

Cheers

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Anchor question
« Reply #3 on: September 13, 2013, 10:49:51 AM »
Is your camera at (0, 0, 0) correctly? Are there any other offsets in transforms leading up to the anchor and/or camera?