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
public float ScreenToWorldScale(float z = 0) => 1 / Vector2.Distance(ScreenToWorld(0, 0, z), ScreenToWorld(1, 0, z));
Should be
public float ScreenToWorldScale(float z = 0) => Vector2.Distance(ScreenToWorld(0, 0, z), ScreenToWorld(1, 0, z));
The reason it's bad is that let's say I have 200 pixels in screen scale and I want to know how many pixels that is in world scale, right now you have to do:
float inWorldScale = 200f / ScreenToWorldScale();
but it should be
float inWorldScale = 200f * ScreenToWorldScale();
Saves 2 divisions.
The text was updated successfully, but these errors were encountered:
public float ScreenToWorldScale(float z = 0) => 1 / Vector2.Distance(ScreenToWorld(0, 0, z), ScreenToWorld(1, 0, z));
Should be
public float ScreenToWorldScale(float z = 0) => Vector2.Distance(ScreenToWorld(0, 0, z), ScreenToWorld(1, 0, z));
The reason it's bad is that let's say I have 200 pixels in screen scale and I want to know how many pixels that is in world scale, right now you have to do:
float inWorldScale = 200f / ScreenToWorldScale();
but it should be
float inWorldScale = 200f * ScreenToWorldScale();
Saves 2 divisions.
The text was updated successfully, but these errors were encountered: