Forum rules - please read before posting.

Camera target not in the center

edited July 2019 in Engine development

Hello,

I've come across to a strange behaviour today. I've created a wider scene and thus I needed to unlock the camera and set it's constrain. At first it behaved really strange and I couldn't get the results I wanted to but then when I've removed the constrain I've noticed that the player target was always at the right edge of the camera instead of it's center. So basically it's possible to walk only to the left direction and when the camera movement stops the player stays at the edge.

I can't find why is that happening.
Offset, Track freedom and Target direction factor options are all set to 0.

Any ideas?
Thanks for help.

2019.1.9f1
1.68.3

Comments

  • Note: The problem is only horizontal. Vertically it works fine.

  • edited July 2019

    Sorry, but I'm going to need more information - screenshots of the camera's full Inspector (both the GameCamera and Unity Camera components), and a couple of the scene to illustrate the problem itself.

    Where in relation to the camera is the scene's PlayerStart, and is the player's origin at their feet? Does the same issue occur if you drop the "Brain2D" player prefab (from the 2D Demo) into the scene to override you own?

  • edited July 2019

    Yes same result with Brain2D. I've also tried copying my player to your demo and it worked fine. (New project with only AC imported) I've tried unchecking the player and adding a regular scene object and it was still causing the same problem, so I believe it's not connected to the player object itself. It's making the same calculation for any object.

    Screenshots: https://imgur.com/a/CGfS3aJ
    Scene screen recording:

    Note: SuperBlur is a only a blur shader, it happens even if it's disabled. (And I've also used it before when the camera worked)

    I don't know how to answer to your question about PlayerStart and player's origin. Do you mean the circle collider? That's at the player's feet.

  • Can't see anything immediately wrong - PM me the scene file and I'll take a look.

  • The behaviour doesn't make any sense to me. I've sent you the scene - It's basically a completely empty scene for purpose of better debugging.
    Hopefully there's a solution to this.

  • This is due to a conflict of the camera's projection being set to Orthographic, which assumes that the camera is positioned in the screen's centre.

    Set the camera's x position to zero, and it should follow the character correctly.

  • Oh, you're amazing. Thank you, Chris. It solved the problem.

    I happened to have the right edge of the GameCamera2D in the centre of the main camera. It makes sense now. I had no idea it works this way, thanks for explaining.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.