# libgdx Vector.cpy question

Why do people use this:

public void set(Vector2 v) {
this.vector2 = v.cpy();
}


insted of just using:

public void set(Vector2 v) {
this.vector2 = v;
}


What I don't know that I should know?

• The first one is creating a new object and assigning its reference to a variable. The second one is just assigning an object to a variable, so you would just end up with 2 variables pointing to the same object. So modifying 1 object's properties (for example x), would modify the other object as well. – dimitris93 Jul 15 '15 at 9:22