Hello Guest

Author Topic: Move tk2dCamera  (Read 5994 times)

pdform

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 12
    • View Profile
    • The Balance Inc
Move tk2dCamera
« on: February 05, 2013, 11:24:24 pm »
Hi,

I've searched the forum and didn't find anyone with this exact issue... I want to use tk2dCamera, because of the facilities it provides, however, since the objects' (absolute) positions are turned into their position on the screen, it is necessary to move the objects, i.e., apply a negative offset to the whole scene, in order to simulate a positive offset in the camera. In most cases, it seems much more intuitive to me moving the camera instead of the objects, when I want the camera to follow a certain object or to achieve a certain movement pattern. Am I missing something here, or is it actually the expected behavior? Is there any simple way to make the objects' relative position to the camera their actual position on screen?

Thanks in advance!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Move tk2dCamera
« Reply #1 on: February 05, 2013, 11:44:24 pm »
If you move the tk2dCamera physically in Unity, you will be moving the camera in 3D space. Eg if your sprites are at 0,0 and you move your camera to the right (i.e. increase camera.transform.x), your sprites will get left behind to the left of the camera. This is of course assuming that the sprite isn't attached to the camera, either in the hierarchy or through anchoring.

If the sprites are anchored to the camera, they will always follow the camera, you can't move away from them.

If the sprites are attached to the camera, but not anchored (i.e. they are children in the hierarchy) then the relative position of them to the camera will be the actual position on screen always, regardless of the position of the camera.

Not sure if that explains it...

pdform

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 12
    • View Profile
    • The Balance Inc
Re: Move tk2dCamera
« Reply #2 on: February 05, 2013, 11:47:59 pm »
I see, so I was missing the point. Thanks!