You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I make a Vector2(0,0), and if I render a sprite in this position, the sprite will rendered at center of screen, but, if I use camera.ToWorld with mouse position, it return the wrong value.
The text was updated successfully, but these errors were encountered:
I have the same problem.
Camera.ViewportOffset.ToAbsolutePosition seems to work fine though. Haven't tested with zoom and rotation, since i don't need it, so it might not work there.
I found a solution that seems to work fine afterwards, just use the code below, for me it worked:
var mstate = Mouse.GetState();
Vector2 mpos = new Vector2(mstate.X, mstate.Y);
mpos = Vector2.Transform(position, camera.ViewportOffset.Absolute);
It seems that ToWorld returns the argument plus the position of the camera.
I make a Vector2(0,0), and if I render a sprite in this position, the sprite will rendered at center of screen, but, if I use camera.ToWorld with mouse position, it return the wrong value.
The text was updated successfully, but these errors were encountered: