Invert a Vector2

I am trying to make a Interactive surface like they had in doom 3 and i am trying to get a cursor working
but if i look up the cursor goes down i look down it goes up.

my code

        RectTransform CanvasRect = myCanvas.GetComponent<RectTransform>();

        Vector2 ViewportPosition = Cam.WorldToViewportPoint(WorldObject.transform.position);
        Vector2 WorldObject_ScreenPosition = new Vector2(
        ((ViewportPosition.x * CanvasRect.sizeDelta.x) - (CanvasRect.sizeDelta.x * 0.5f)),
        ((ViewportPosition.y * CanvasRect.sizeDelta.y) - (CanvasRect.sizeDelta.y * 0.5f)));


        UI_Element.anchoredPosition = WorldObject_ScreenPosition;

Try inverting your y axis.

((ViewportPosition.y * CanvasRect.sizeDelta.y) - (CanvasRect.sizeDelta.y * -0.5f)));

i did that but didn’t seem to work in fact with -0.5f the cursor just shoots off into space.

This work?
((ViewportPosition.y * CanvasRect.sizeDelta.y) + (CanvasRect.sizeDelta.y * 0.5f)));

no doing that has no effect i am using the canvas set to world space rendering if that matters.

Vector2 direction *= (Vector2.left + Vector2.down);

1 Like