# Keep an object in the same place on the screen by moving it on the Y axis

Hi everyone.
In my editor I work in GameView (in edit mode) moving 3D objects with custom controls.
I’m trying to achieve the following:

When I move the plane on the Y axis it obviously keeps x and z constant.

Instead, I would need the x and z axes to change as well so that the vertex of the plane always appears to be in the same position on the screen.

I tried to use `WorldToScreenPoint `and then `ScreenPointToRay `but without success.
Do you have any suggestions to put me on the right track?

Alright, I found a satisfactory solution. Planes are meshes that I create, so I have their vertices.
First, I store the vertices with `WorldToScreenPoint `in a list.

``````List<Vector3> ShapeVertices = new List<Vector3>();
int Size = MyShape.Count;
for (int i = 0; i <= listSize - 1; i++) {
}
``````

Then I iterate again all the vertices adding or subtracting, according to the direction of the plane, a small value to Y.

``````for (int i = 0; i <= listSize - 1; i++) {
Vector3 Vertices = MyShape[i];
Vertices.y += 0.1f;
// or Vertices.y -= 0.1f;
MyShape[i] = Vertices;
}
``````

Now I create a new plane at the Y level of the modified position of the shape.

``````Plane plane = new Plane(Vector3.up, new Vector3(0.0f, MyShape[0].y, 0.0f));
``````

And finally I use `Raycast` with `ScreenPointToRay` .

``````float enter = 0.0f;
Ray ray;
for (int i = 0; i < ShapeVertices.Count; i++) {
ray = cam.ScreenPointToRay(ShapeVertices[i]);
if (plane.Raycast(ray, out enter)) {
MyShape[i] = ray.GetPoint(enter);
}
}
``````

Now the new vertices are exactly where they were on the screen before changing the Y-axis.
From here, I just have to delete the old mesh and create the new one.

Out of curiosity, what are you trying to accomplish?

It’s for a project I’m working on.
it’s a bit long to explain, but what I need is that the camera always frames the mesh of the same apparent starting shape and size, regardless of whether the mesh is moved on the Y axis
Actually the third picture I posted above doesn’t exactly reflect what’s going on. The four vertices, by changing their position, also change the size of the mesh, and the final result, with a fixed camera, will always be like the first image.