I have this small problem im using a custom texture for the mouse pointer but the texture does not properly aline with the mouse pointer (Please see the attached image)
I want it to aline it properly with the mouse pointer.
looks perfectly correct. Upper left edge is the hotspot.
Or do you want the hotspot to be in the middle of the image? Then you have to translate your image coordinates so the mouse position is in the center of the image.
I tried using ur method n its working properly however now the CrossHair movement is inverted if i move my mouse course up the crosshair moves down (See Image).
Also here is the code im using, Im using C#:-
public class Aim : MonoBehaviour {
public Texture crosshairTexture;
// Use this for initialization
void Start () {
}
// Update is called once per frame
public void OnGUI () {
Vector3 Mouseposition = Input.mousePosition;
float ImagePosX;
float ImagePosY;
ImagePosX = Mouseposition.x - crosshairTexture.width / 2.0f;
ImagePosY = Mouseposition.y - Screen.height / 2.0f;
Rect Position = new Rect(ImagePosX,ImagePosY,crosshairTexture.width,crosshairTexture.height);
GUI.Label(Position,crosshairTexture);
}
}