Weird behaviour - Vector addition

Hi, I am developing a game on Unity for Android platform. I have run into a basic issue and the question might sound a little stupid to the experts around here. I’ll keep it crisp and to the point.

  1. Does the world coordinate EVER change if I JUST change the camera coordinates? Meaning, If I move my camera right, the world coordinates of the original objects will be the same and the screen coordinates will keep changing. Is this understanding correct?

  2. I have a variable
    var player : Vector3;

When I assign position to this vector, I see a weird behaviour.

player = gameObj_2.GetComponent(Player).transform.position
This puts the player somewhere in the middle of the screen (wherever it was just before this line got executed)
BUT

player = gameObj_2.GetComponent(Player).transform.position + newVector3(0.2,0,0);
This brings the player to the left end of the screen. What is weird is gameObj_2.GetComponent(Player).transform.position.x is positive. So when I add something, it should most definitely move to the right but it is moving to the left. Isn;t this a simple vector addition?
Few more points to help you assess -

  1. The camera is constantly moving to the right at a constant speed.
  2. This is all in 2D.

Any help will be appreciated. Let me know if there is more information required.

I am not sure the vector operations always work as we’d expect. For my platform game I had position and speed vector3Ds. And added using the .x and .y properties. Worked fine. For my new Christmas game I thought why can’t I just add the vector to the position and so i did that simply as v3Position += v3Speed and only achieved movement in one direction. Not sure if it was always favoring negative or positive but I saw the same behavior you are describing so changed back to the expanded notation of separate .x and .y

Thanks for the inputs GarBenjamin. I’ll try that.

The code for adding Vector3s in Unity is literally:

public static Vector3 operator + (Vector3 a, Vector3 b)
{
    return new Vector3 (a.x + b.x, a.y + b.y, a.z + b.z);
}

That’s it; there’s no favoring of anything. As for Transform.position, it will never change unless it is explicitly changed by some action.

–Eric

Check out your camera orientation you might have your camera flip upside down.