Convert a point from world coordinates to target coordinates.
This function finds the pixel of the render-target that matches the given
2D point. In other words, it goes through the same process as the
graphics card, to compute the final position of a rendered point.
Initially, both coordinate systems (world units and target pixels) match
perfectly. But if you define a custom view or resize your render-target,
this assertion is not true anymore, ie. a point located at (150, 75) in
your 2D world may map to the pixel (10, 50) of your render-target – if
the view is translated by (140, 25).
This version uses a custom view for calculations, see the other overload
of the function if you want to use the current view of the render-target.
Convert a point from world coordinates to target coordinates.
This function finds the pixel of the render-target that matches the given 2D point. In other words, it goes through the same process as the graphics card, to compute the final position of a rendered point.
Initially, both coordinate systems (world units and target pixels) match perfectly. But if you define a custom view or resize your render-target, this assertion is not true anymore, ie. a point located at (150, 75) in your 2D world may map to the pixel (10, 50) of your render-target – if the view is translated by (140, 25).
This version uses a custom view for calculations, see the other overload of the function if you want to use the current view of the render-target.