- Home /
Unity2D Coordinates while velocity is on
Hey,
i have a problem with my Rigidbody2D.position.x/y. Thats what i see with
Debug.Log(rigidbody2D.transform.position.x + " | " + rigidbody2D.transform.localPosition.x);
So my questions :
Why i have to move my object first to see cords ?
And why are these cords negative e.g my buttons i have to set them to (10,60)so they are in the top left corner ?
Regards
LifeArtist
Answer by stevethorne · Mar 20, 2014 at 06:21 PM
You're printing out the world position's x and the local position's x. In this case neither are changing until the yellow part because you aren't moving in the x direction, you're moving in the y direction.
Second, the coordinates are in world position, not screen position. So it starts at a world position of ( 0, 0 ), I imagine, and then you move it in the negative x direction so the x of it's position is negative. It has no relation to where your button is on screen, it has to do with where it is in the world.
$$anonymous$$h ... do u know how i can change from world to screen position ?
You should accept the answer as a solution if it solves your problem
Your answer
![](https://koobas.hobune.stream/wayback/20220613140738im_/https://answers.unity.com/themes/thub/images/avi.jpg)