consider clipPos and clipScale for raycast #23.
This commit is contained in:
@@ -409,6 +409,19 @@ public class Texture : MonoBehaviour
|
|||||||
// Calculate coordinates.
|
// Calculate coordinates.
|
||||||
var coordX = toAngle / halfWidthAngle * 0.5f;
|
var coordX = toAngle / halfWidthAngle * 0.5f;
|
||||||
var coordY = ly / halfHeight * 0.5f;
|
var coordY = ly / halfHeight * 0.5f;
|
||||||
|
|
||||||
|
// Zoom
|
||||||
|
if (useClip) {
|
||||||
|
coordX = clipPos.x + (0.5f + coordX) * clipScale.x;
|
||||||
|
coordX -= Mathf.Floor(coordX);
|
||||||
|
coordX -= 0.5f;
|
||||||
|
|
||||||
|
coordY = (1f - clipPos.y) + (coordY - 0.5f) * clipScale.y;
|
||||||
|
coordY -= Mathf.Floor(coordY);
|
||||||
|
coordY -= 0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Desktop position
|
||||||
int desktopX = monitor.left + (int)((coordX + 0.5f) * monitor.width);
|
int desktopX = monitor.left + (int)((coordX + 0.5f) * monitor.width);
|
||||||
int desktopY = monitor.top + (int)((0.5f - coordY) * monitor.height);
|
int desktopY = monitor.top + (int)((0.5f - coordY) * monitor.height);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user